rrrene / credo

A static code analysis tool for the Elixir language with a focus on code consistency and teaching.
http://credo-ci.org/
MIT License
4.94k stars 419 forks source link

fix: NegatedIsNil memory leak #1094

Closed msutkowski closed 1 year ago

msutkowski commented 1 year ago

Fixes #1056.

Prior to this, this example test would raise 9 issues:

test "regression test for issue list duplication" do
  """
  defmodule CredoSampleModule do
    def hello(a) when not is_nil(a), do: a
    def foo1(x) when is_integer(x), do: x
    def foo2(x) when is_integer(x), do: x
    def foo3(x) when is_integer(x), do: x
  end
  """
  |> to_source_file()
  |> run_check(@described_check)
  |> assert_issue()
end
rrrene commented 1 year ago

@msutkowski Thx!

pdm-jd commented 1 year ago

Thanks for fixing this!