Skip to content

Commit

Permalink
Merge pull request #693 from mirego/fix/fix-unused-variable-naming-pa…
Browse files Browse the repository at this point in the history
…rsing-bug

Fix name parsing bug in Credo.Check.Consistency.UnusedVariableNames
  • Loading branch information
rrrene committed Aug 21, 2019
2 parents 40f8943 + c58c913 commit 13f2899
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ defmodule Credo.Check.Consistency.UnusedVariableNames.Collector do

defp unused_variable_name?({:_, _, _}), do: true

defp unused_variable_name?({name, _, _}),
defp unused_variable_name?({name, _, _}) when is_atom(name),
do: String.starts_with?(Atom.to_string(name), "_")

defp unused_variable_name?(_), do: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ defmodule Credo.Check.Consistency.UnusedVariableNamesTest do
defmodule Credo.SampleOne do
defmodule Foo do
def bar(_, %{foo: foo} = _, _) do
version = Mix.Project.config()[:version]
end
end
end
Expand Down

0 comments on commit 13f2899

Please sign in to comment.