Skip to content

fix: WPS222 false positive for nested conditions#3633

Merged
sobolevn merged 1 commit intowemake-services:masterfrom
vldmrdev:3630-fix-WPS222-false-positive
Apr 22, 2026
Merged

fix: WPS222 false positive for nested conditions#3633
sobolevn merged 1 commit intowemake-services:masterfrom
vldmrdev:3630-fix-WPS222-false-positive

Conversation

@vldmrdev
Copy link
Copy Markdown
Contributor

@vldmrdev vldmrdev commented Apr 22, 2026

I have made things!

  1. Removed recursion from ConditionsVisitor._count_conditions
  2. Modified test cases in test_condition_counts.py - added more non-nested conditions to match the default max number of conditions (4).
  3. Added test case for list comprehension with conditions to test_condition_counts.py

Checklist

  • I have double checked that there are no unrelated changes in this pull request (old patches, accidental config files, etc)
  • I have created at least one test case for the changes I have made
  • I have updated the documentation for the changes I have made
  • I have added my changes to the CHANGELOG.md

Related issues

Closes #3630

@vldmrdev vldmrdev force-pushed the 3630-fix-WPS222-false-positive branch from 73d1b29 to 400fa8a Compare April 22, 2026 01:40
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (88d8755) to head (2500679).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3633   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          369       369           
  Lines        12414     12410    -4     
  Branches       860       858    -2     
=========================================
- Hits         12414     12410    -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add .. versionchanged:: to the violation class with the description: what has changed in the algorithm.

@vldmrdev vldmrdev force-pushed the 3630-fix-WPS222-false-positive branch 2 times, most recently from 7290e6f to dc417a9 Compare April 22, 2026 13:54
Comment thread wemake_python_styleguide/visitors/ast/complexity/counts.py Outdated
@vldmrdev vldmrdev force-pushed the 3630-fix-WPS222-false-positive branch from dc417a9 to a9a889e Compare April 22, 2026 14:15
Comment thread wemake_python_styleguide/violations/complexity.py Outdated
Comment thread wemake_python_styleguide/violations/complexity.py Outdated
Comment thread CHANGELOG.md Outdated
@vldmrdev vldmrdev force-pushed the 3630-fix-WPS222-false-positive branch from a9a889e to 2500679 Compare April 22, 2026 17:40
@sobolevn sobolevn merged commit 3771f75 into wemake-services:master Apr 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WPS222 false positive

2 participants