WPS366: forbid useless bool expressions#3605
Merged
sobolevn merged 4 commits intowemake-services:masterfrom Feb 23, 2026
Merged
WPS366: forbid useless bool expressions#3605sobolevn merged 4 commits intowemake-services:masterfrom
sobolevn merged 4 commits intowemake-services:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3605 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 368 369 +1
Lines 12291 12335 +44
Branches 853 858 +5
=========================================
+ Hits 12291 12335 +44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sobolevn
reviewed
Feb 22, 2026
| Forbid meaningless boolean operations. | ||
|
|
||
| Reasoning: | ||
| Some parts of a boolean expression may be redundant, |
Member
There was a problem hiding this comment.
Please, describe what parts are redundant and why :)
| if is_zero_division: | ||
| self.add_violation(consistency.ZeroDivisionViolation(number)) | ||
|
|
||
| def _check_useless_bool_operator( # noqa: WPS210 |
Member
There was a problem hiding this comment.
Please, do not ignore complexity violations. Refactor this function into several helper ones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have made things!
This adds a new rule
WPS366which disallows useless boolean operations.It partially coincides with the ruff's
SIM223, but complements it.Checklist
CHANGELOG.mdRelated issues
Closes #3593