Closed rubensayshi closed 2 years ago
I'm not very familiar with semgrep's workings, but maybe this is related: https://github.com/returntocorp/semgrep/issues/3198 ?
I believe this behavior was there even before Semgrep 0.56 since the rule just checks for any X.Y access after an if: https://github.com/dgryski/semgrep-go/blob/master/badnilguard.yml#L6
pattern: $X != nil || <... $X.$F ...>
that's after an != nil ||
only, not after != nil &&
This is https://github.com/returntocorp/semgrep/issues/3399 which will be fixed in the next semgrep release.
awesome! sorry I couldn't be off my help than reporting it
This has been fixed for a while now.
as of semgrep 0.56 the bad-nil-guard pattern check seems to check both ways and as a result flags good nil guards as well: