Skip to content

Commit 175d0ab

Browse files
committed
Fix false positive for UnsafeToAtom
Refs #1148
1 parent 3a6a0c0 commit 175d0ab

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/credo/check/warning/unsafe_to_atom.ex

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ defmodule Credo.Check.Warning.UnsafeToAtom do
5252
{nil, issues}
5353
end
5454

55+
# module.unquote(:"some_atom")
56+
defp traverse({{:., _, [_, :unquote]}, _, [_ | _] = _args}, issues, _) do
57+
{nil, issues}
58+
end
59+
5560
defp traverse(
5661
{:|>, _meta1, [_lhs, {{:., _meta2, call}, meta, args}]} = ast,
5762
issues,

test/credo/check/warning/unsafe_to_atom_test.exs

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ defmodule Credo.Check.Warning.UnsafeToAtomTest do
3535
3636
def convert_erlang_binary(parameter) do
3737
:erlang.binary_to_existing_atom(parameter, :utf8)
38+
39+
unquote(context).unquote(:"get_#{type}_by")(id: id)
3840
end
3941
4042
for n <- 1..4 do

0 commit comments

Comments
 (0)