no-assignment-in-logical-condition
What it does
Section titled “What it does”Reports a condition that is a logical operation (&&, ||) with an assignment as the right operand not in parentheses (if a && b = c). An assignment as the whole condition is no-assignment-in-condition.
Why it matters
Section titled “Why it matters”In a && b = c the assignment is easy to read as a comparison (==), and the value of the whole condition is the assigned value, so the code branches on the wrong thing.
To fix, use == if a comparison was meant, or put the assignment in parentheses if it is on purpose.
Example
Section titled “Example”...when 1 then y...endif a && b = c dendbegin...Configuration
Section titled “Configuration”ruby: lint: rules: no-assignment-in-logical-condition: warn # off, warn (default), errorEnabled by the presets: ruby/rubocop.
Suppress one line with sudsy-disable-next-line no-assignment-in-logical-condition in a comment of the file’s language.