Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
New Check: AvoidFinalConditionInversion #112
We need a check that could catch "not" operator - "!" (an exclamation mark) that is used as final operation, but it is possible without changing a meaning of condition change its parts to make condition more readable.
Bad code examples:
Big example (not sure we could catch such cases):
Message should be simple, do not propose solution.
Yes, loops, if , returns should be checked.
Beware that check might find some very debatable cases, please run it on big projects and try to make sure that code would become better after required changes (some additional options might be required)
According to De Morgan's lows the resulted expressions should be as follows: