     find_issue(map, issue_meta, def_names, excluded_names)
   end
   def find_issue({name, meta, _}, issue_meta, def_names, excluded_names) do
-    def_name_with_op =
-      def_names
-      |> Enum.find(fn({def_name, _op}) -> def_name == name end)
+    line_no = meta[:line]
+    def_op = def_names |> find_def_op(name)
+
     cond do
       excluded_names |> Enum.member?(name) ->
         nil
-      def_name_with_op ->
-        what =
-          case def_name_with_op do
-            {_, :def} -> "a function in the same module"
-            {_, :defp} -> "a private function in the same module"
-            {_, :defmacro} -> "a macro in the same module"
-            _ -> "ERROR"
-          end
-        issue_for(issue_meta, meta[:line], name, what)
+      def_op ->
+        issue_for(issue_meta, line_no, name, message_for_def(def_op))
       @kernel_fun_names |> Enum.member?(name) ->
-        issue_for(issue_meta, meta[:line], name, "the `Kernel.#{name}` function")
+        issue_for(issue_meta, line_no, name, "the `Kernel.#{name}` function")
       @kernel_macro_names |> Enum.member?(name) ->
-        issue_for(issue_meta, meta[:line], name, "the `Kernel.#{name}` macro")
+        issue_for(issue_meta, line_no, name, "the `Kernel.#{name}` macro")
       true ->
         nil
     end

  end
  def find_issue(_, _, _, _) do
    nil
  end

  defp issue_for(issue_meta, line_no, trigger, what) do

  ]
  @excluded_names [:_, :sigil_r, :sigil_R]

  alias Credo.Code
  alias Credo.Code.Module

  use Credo.Check, base_priority: :high
