lpil / dogma

:closed_lock_with_key: A code style linter for Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception against Phoenix repo.

fazibear opened this issue · comments

Tried dogma against Phoenix repo and get this error:

** (EXIT from #PID<0.46.0>) an exception was raised:
    ** (Protocol.UndefinedError) protocol String.Chars not implemented for {:unquote, [line: 180], [{{:., [line: 180], [:erlang, :binary_to_atom]}, [line: 180], [{:<<>>, [line: 180], [{:::, [line: 180], [{{:., [line: 180], [Kernel, :to_string]}, [line: 180], [{:helper, [line: 180], nil}]}, {:binary, [line: 180], nil}]}, "_path"]}, :utf8]}]}
        (elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1
        (elixir) lib/string/chars.ex:17: String.Chars.to_string/1
        lib/dogma/rule/taken_name.ex:72: Dogma.Rule.TakenName.check_name/4
        (elixir) lib/macro.ex:296: anonymous fn/4 in Macro.do_traverse_args/4
        (elixir) lib/enum.ex:1247: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
        (elixir) lib/macro.ex:262: Macro.do_traverse/4
        (elixir) lib/macro.ex:277: Macro.do_traverse/4
        (elixir) lib/enum.ex:1247: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3

20:20:13.026 [error] Task #PID<0.1160.0> started from #PID<0.46.0> terminating
** (Protocol.UndefinedError) protocol String.Chars not implemented for {:unquote, [line: 180], [{{:., [line: 180], [:erlang, :binary_to_atom]}, [line: 180], [{:<<>>, [line: 180], [{:::, [line: 180], [{{:., [line: 180], [Kernel, :to_string]}, [line: 180], [{:helper, [line: 180], nil}]}, {:binary, [line: 180], nil}]}, "_path"]}, :utf8]}]}
    (elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1
    (elixir) lib/string/chars.ex:17: String.Chars.to_string/1
    lib/dogma/rule/taken_name.ex:72: Dogma.Rule.TakenName.check_name/4
    (elixir) lib/macro.ex:296: anonymous fn/4 in Macro.do_traverse_args/4
    (elixir) lib/enum.ex:1247: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir) lib/macro.ex:262: Macro.do_traverse/4
    (elixir) lib/macro.ex:277: Macro.do_traverse/4
    (elixir) lib/enum.ex:1247: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
Function: #Function<1.53947851/0 in Dogma.Rules.test/3>
    Args: []

Looks like Dogma.Rule.TakenName.check_name/4 needs a clause to prevent crashing when the name is a function call.

Clone of #208