Skip to content

Commit

Permalink
Add test reproducing false negative for ModuleDoc
Browse files Browse the repository at this point in the history
Refs #1168
  • Loading branch information
rrrene committed Dec 13, 2024
1 parent cf40ca2 commit bfa64f5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/credo/check/readability/module_doc_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ defmodule Credo.Check.Readability.ModuleDocTest do
|> refute_issues()
end

test "it should NOT report modules or submodules when @moduledoc is present" do
"""
defmodule Foo do
@moduledoc false
defmodule Bar do
@moduledoc false
end
end
"""
|> to_source_file
|> run_check(@described_check, ignore_names: [])
|> refute_issues()
end

#
# cases raising issues
#
Expand All @@ -70,6 +85,20 @@ defmodule Credo.Check.Readability.ModuleDocTest do
|> assert_issue()
end

test "it should report modules when @moduledoc is present in submodules only" do

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / all triggers are looked up and confirmed

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.13.4 OTP 24.3

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.14.5 OTP 24.3

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.13.4 OTP 25.3

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.17.3 OTP 25.3

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 OTP 25.3

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.16.2 OTP 25.3

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.18.0-rc.0 OTP 25.3

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.17.3 OTP 26.2

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 OTP 26.2

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.18.0-rc.0 OTP 26.2

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)

Check failure on line 88 in test/credo/check/readability/module_doc_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.16.2 OTP 26.2

test it should report modules when @moduledoc is present in submodules only (Credo.Check.Readability.ModuleDocTest)
"""
defmodule Foo do
# distinctly no moduledoc here
defmodule Bar do
@moduledoc false
end
end
"""
|> to_source_file
|> run_check(@described_check, ignore_names: [])
|> assert_issue()
end

test "it should report empty strings" do
"""
defmodule CredoSampleModule do
Expand Down

0 comments on commit bfa64f5

Please sign in to comment.