Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New rule: DoubleNegativeExpression #7035

Closed
osipxd opened this issue Mar 9, 2024 · 0 comments · Fixed by #7048
Closed

New rule: DoubleNegativeExpression #7035

osipxd opened this issue Mar 9, 2024 · 0 comments · Fixed by #7048
Labels

Comments

@osipxd
Copy link
Contributor

osipxd commented Mar 9, 2024

This issue is continue of discussion started in #7019 (comment)

Expected Behavior of the rule

Expression with two or more calls of operator not could be simplified.

// Noncompliant
isValid.not().not()
!isValid.not()
!!isValid
!!!isValid

// Compliant
isValid
!isValid
isValid.not()

Context

When you prefer to use .not() over !, it is quite easy to get construction like !isValid.not() as a result of automatic IDE refactorings (e.g. "Invert 'If' condition", "Replace '||' with '&&'")
Additional context: #7019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant