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

Issue 3265: Add WPS476 SneakyTypeVarWithDefaultViolation #3314

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

Tapeline
Copy link
Contributor

@Tapeline Tapeline commented Feb 20, 2025

I have made things!

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

Note

Making of this feature resulted into a refactoring of visitors.ast.classes following 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.

Copy link
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.

Thanks!

Copy link

codecov bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (724cd61) to head (082b819).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3314   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          357       361    +4     
  Lines        11715     11774   +59     
  Branches       802       804    +2     
=========================================
+ Hits         11715     11774   +59     

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

Comment on lines 37 to 39
IGNORED_VIOLATIONS3_13 = (

)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
IGNORED_VIOLATIONS3_13 = (
)
IGNORED_VIOLATIONS3_13 = ()

Comment on lines 302 to 306
SHOULD_BE_RAISED3_13 = types.MappingProxyType(
dict.fromkeys(SHOULD_BE_RAISED, 0) | {
'WPS476': 1
}
)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Member

Choose a reason for hiding this comment

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

'class_header',
[
(
"T = TypeVar('T')\n"
Copy link
Member

Choose a reason for hiding this comment

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

Please, move multiline example to variables, it is easier to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The whole list, or each individual example to its variable?

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.

Do not allow TypeVarTuple after TypeVar with a default
2 participants