Closed pdm-jd closed 9 months ago
If a custom guard uses not is_nil(foo), the number of issues reported by Credo.Check.Refactor.NegatedIsNil increases significantly.
not is_nil(foo)
Credo.Check.Refactor.NegatedIsNil
For instance, this would report three violations.
defguard custom_guard(value) when not is_nil(value) def bar(foo, baz) when not is_nil(foo) and custom_guard(baz) do end
This change ensures only a maximum of one issue per part of the guard will be reported. See the added tests for examples.
Oof, https://github.com/rrrene/credo/pull/1094 beat me too it.
@pdm-jd Still glad you took the time :+1:
If a custom guard uses
not is_nil(foo)
, the number of issues reported byCredo.Check.Refactor.NegatedIsNil
increases significantly.For instance, this would report three violations.
This change ensures only a maximum of one issue per part of the guard will be reported. See the added tests for examples.