binary-operator-with-identical-operands
What it does
Section titled “What it does”Reports a comparison, logical or bitwise operator (== != === <=> =~ > >= < <= | ^ && ||) whose two sides are the same code (x == x).
Why it matters
Section titled “Why it matters”The result is constant, or the operand is repeated by mistake: the second one was meant to be another variable.
To fix, correct one operand, or write the constant result.
Example
Section titled “Example”...x == xa && aa == bConfiguration
Section titled “Configuration”ruby: lint: rules: binary-operator-with-identical-operands: warn # off, warn (default), errorEnabled by the presets: ruby/rubocop.
Suppress one line with sudsy-disable-next-line binary-operator-with-identical-operands in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| rubocop | Lint/BinaryOperatorWithIdenticalOperands |
full |