Skip to content

Commit

Permalink
Fix error on single-line modules
Browse files Browse the repository at this point in the history
Refs #966
  • Loading branch information
rrrene committed Jul 30, 2022
1 parent 1261f6c commit 3046864
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/credo/priority.ex
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ defmodule Credo.Priority do
|> Enum.slice(0..(length(names) - 2))
|> Enum.join(".")

mod_prio = lookup[mod_name]
mod_prio = lookup[mod_name] || 0

{scope_name, prio + mod_prio}
else
Expand Down
9 changes: 9 additions & 0 deletions test/credo/check/readability/module_doc_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,13 @@ defmodule Credo.Check.Readability.ModuleDocTest do
|> run_check(@described_check)
|> assert_issue()
end

test "it should report slightly unexpected code" do
"""
defmodule Person, do: def greet(), do: :howdy
"""
|> to_source_file
|> run_check(@described_check)
|> assert_issue()
end
end

0 comments on commit 3046864

Please sign in to comment.