diff --git a/lib/credo/priority.ex b/lib/credo/priority.ex index bc1f0f6d6..856112c1a 100644 --- a/lib/credo/priority.ex +++ b/lib/credo/priority.ex @@ -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 diff --git a/test/credo/check/readability/module_doc_test.exs b/test/credo/check/readability/module_doc_test.exs index 24e360067..e3dd548d5 100644 --- a/test/credo/check/readability/module_doc_test.exs +++ b/test/credo/check/readability/module_doc_test.exs @@ -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