diff --git a/lib/credo/check/warning/unsafe_to_atom.ex b/lib/credo/check/warning/unsafe_to_atom.ex index 921cd1cdf..a96cdeb1b 100644 --- a/lib/credo/check/warning/unsafe_to_atom.ex +++ b/lib/credo/check/warning/unsafe_to_atom.ex @@ -52,6 +52,11 @@ defmodule Credo.Check.Warning.UnsafeToAtom do {nil, issues} end + # module.unquote(:"some_atom") + defp traverse({{:., _, [_, :unquote]}, _, [_ | _] = _args}, issues, _) do + {nil, issues} + end + defp traverse( {:|>, _meta1, [_lhs, {{:., _meta2, call}, meta, args}]} = ast, issues, diff --git a/test/credo/check/warning/unsafe_to_atom_test.exs b/test/credo/check/warning/unsafe_to_atom_test.exs index e3aeb93a1..a73d3f8bf 100644 --- a/test/credo/check/warning/unsafe_to_atom_test.exs +++ b/test/credo/check/warning/unsafe_to_atom_test.exs @@ -35,6 +35,8 @@ defmodule Credo.Check.Warning.UnsafeToAtomTest do def convert_erlang_binary(parameter) do :erlang.binary_to_existing_atom(parameter, :utf8) + + unquote(context).unquote(:"get_#{type}_by")(id: id) end for n <- 1..4 do