Issue 3265: Add WPS476 SneakyTypeVarWithDefaultViolation#3314
Issue 3265: Add WPS476 SneakyTypeVarWithDefaultViolation#3314sobolevn merged 39 commits intowemake-services:masterfrom
Conversation
…thDefaultViolation and corresponding tests
# Conflicts: # wemake_python_styleguide/visitors/ast/classes.py
# Conflicts: # tests/test_visitors/test_ast/test_classes/test_type_var_with_default.py
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3314 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 358 361 +3
Lines 11761 11814 +53
Branches 803 805 +2
=========================================
+ Hits 11761 11814 +53 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| IGNORED_VIOLATIONS3_13 = ( | ||
|
|
||
| ) |
There was a problem hiding this comment.
| IGNORED_VIOLATIONS3_13 = ( | |
| ) | |
| IGNORED_VIOLATIONS3_13 = () |
| SHOULD_BE_RAISED3_13 = types.MappingProxyType( | ||
| dict.fromkeys(SHOULD_BE_RAISED, 0) | { | ||
| 'WPS476': 1 | ||
| } | ||
| ) |
There was a problem hiding this comment.
| SHOULD_BE_RAISED3_13 = types.MappingProxyType( | |
| dict.fromkeys(SHOULD_BE_RAISED, 0) | { | |
| 'WPS476': 1 | |
| } | |
| ) | |
| SHOULD_BE_RAISED3_13 = types.MappingProxyType( | |
| { | |
| 'WPS476': 1 | |
| } | |
| ) |
Let's simplify this case.
There was a problem hiding this comment.
Testcases check that every violation code is defined in such dictionary, so I was forced to add that line. Formatter ate my comment on this, btw
There was a problem hiding this comment.
| 'class_header', | ||
| [ | ||
| ( | ||
| "T = TypeVar('T')\n" |
There was a problem hiding this comment.
Please, move multiline example to variables, it is easier to read.
There was a problem hiding this comment.
The whole list, or each individual example to its variable?
There was a problem hiding this comment.
we use examples like this:
wrong_type_var_defaults = """
T = TypeVar('T')
# ...
"""# Conflicts: # tests/test_visitors/test_ast/test_classes/test_type_var_with_default.py
# Conflicts: # poetry.lock
sobolevn
left a comment
There was a problem hiding this comment.
Almost ready! Just tests to fix :)
| ): | ||
| """Test that WPS476 works correctly.""" | ||
| src = ( | ||
| f'{classes_with_various_bases}\n' |
There was a problem hiding this comment.
Why do we need this line here? It should be a separate test.
There was a problem hiding this comment.
Removed this line, because it's included in test_type_var_ignored testcase
# Conflicts: # CHANGELOG.md # poetry.lock # tests/test_checker/test_noqa.py # wemake_python_styleguide/violations/best_practices.py
# Conflicts: # tests/test_visitors/test_ast/test_classes/test_type_var_with_default313.py
I have made things!
Checklist
CHANGELOG.mdRelated issues
TypeVarTupleafterTypeVarwith a default #3265Note
Making of this feature resulted into a refactoring of
visitors.ast.classesfollowing the complexity waterfall. Thorough checking is required🙏 Please, if you or your company is finding wemake-python-styleguide valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/wemake-python-styleguide. As a thank you, your profile/company logo will be added to our main README which receives hundreds of unique visitors per day.