Add --max-conditions option#3495
Conversation
|
|
||
| ### Features | ||
|
|
||
| - Adds `--max-conditions` option |
There was a problem hiding this comment.
| - Adds `--max-conditions` option | |
| - Adds `--max-conditions` option, #3493 |
| - ``max-conditions`` - Maximum number of conditions in a single ``if`` or | ||
| ``while`` statement. |
There was a problem hiding this comment.
| - ``max-conditions`` - Maximum number of conditions in a single ``if`` or | |
| ``while`` statement. | |
| - ``max-conditions`` - Maximum number of conditions in a single boolop expression. |
| This rule is configurable with ``--max-conditions``. | ||
| Default: | ||
| :str:`wemake_python_styleguide.options.defaults.MAX_CONDITIONS` | ||
|
|
There was a problem hiding this comment.
Add .. versionchanged:: 1.4.0 with a description that we made it configurable.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3495 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 363 363
Lines 12021 12029 +8
Branches 819 819
=========================================
+ Hits 12021 12029 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sobolevn
left a comment
There was a problem hiding this comment.
Oh, one last thing: please add a test with options(max_conditions=5) to test that it works. You can find many other similar tests.
|
|
||
| .. versionadded:: 0.1.0 | ||
| .. versionchanged:: 0.5.0 | ||
| .. versionchanged:: 1.4.0 |
There was a problem hiding this comment.
| .. versionchanged:: 1.4.0 | |
| .. versionchanged:: 0.5.0 | |
| .. versionchanged:: 1.4.0 | |
| Added ``--max-conditions`` configuration option. |
| """Testing that expressions counted correctly with custom options.""" | ||
| tree = parse_ast_tree(mode(code)) | ||
|
|
||
| option_values = options(max_expressions=5) |
There was a problem hiding this comment.
This test is a good edition :)
But, it does not test what we do here. Please one more test with max_conditions to the visitor that we are testing.
There was a problem hiding this comment.
@sobolevn thank you for your comment. I also noticed that this test is not working correctly (it should not I gueess), so I removed it and added right test
Add
--max-conditionsoptionChecklist
CHANGELOG.mdRelated issues
closes #3493