You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposal: when an if statement includes the else clause, the if clause should not be negated. The same applies to the ternary operator.
Examples:
// Would trigger:
if !test {methodA()}else{methodB()}
if !(testA || testB){methodA()}else{methodB()}
!test ? methodA():methodB()// Would not trigger:
if test {methodB()}else{methodA()}
if testA || testB {methodB()}else{methodA()}
if test ? methodB():methodA()
Should the rule be configurable, if so what parameters should be configurable?
Not that I can think of.
Should the rule be opt-in or enabled by default? Why?
I, personally, would say yes, as if one is handling both possibilities, there is no need to do it with inverted logic.
The text was updated successfully, but these errors were encountered:
New Issue Checklist
Rule Request
Proposal: when an
if
statement includes theelse
clause, theif
clause should not be negated. The same applies to the ternary operator.Examples:
Should the rule be configurable, if so what parameters should be configurable?
Not that I can think of.
Should the rule be opt-in or enabled by default? Why?
I, personally, would say yes, as if one is handling both possibilities, there is no need to do it with inverted logic.
The text was updated successfully, but these errors were encountered: