dart-lang / linter

Linter for Dart.
https://dart.dev/tools/linter-rules
BSD 3-Clause "New" or "Revised" License
636 stars 170 forks source link

Flag identical boolean expressions in an if statement #173

Open filiph opened 8 years ago

filiph commented 8 years ago
if (View.StereoPass == eSSP_LEFT_EYE ||
    View.StereoPass == eSSP_LEFT_EYE) {
  ...
}

Common copy-paste bug.

alexeieleusis commented 8 years ago

This might be linted now that https://github.com/dart-lang/linter/pull/229 is merged. I might add a test to confirm @pq can you assign this to me?

filiph commented 7 years ago

Is this in?

alexeieleusis commented 7 years ago

It is linted only if the boolean operator is &&.

pq commented 7 years ago

It is linted only if the boolean operator is &&.

@alexeieleusis : are you working on extending it?

Thanks!

alexeieleusis commented 7 years ago

No. But I am surprised that is not linted, I just reviewed tests and we have a few that lint expressions where the operator is ||, so looks like a bug to me. We can leave this open and I will look into it.

Just to set the right expectations, I am a bit low on cycles for this now, but will eventually get to it.

pq commented 7 years ago

NP. Thanks!