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.91k stars 414 forks source link

fix: NegatedIsNil memory leak #1094

Closed msutkowski closed 9 months ago

msutkowski commented 9 months 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 9 months ago

@msutkowski Thx!

pdm-jd commented 9 months ago

Thanks for fixing this!