add TooManyComments (#3689) - #3695
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3695 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 369 371 +2
Lines 12425 12461 +36
Branches 858 862 +4
=========================================
+ Hits 12425 12461 +36 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I'll squash the commits at the end, please don't squash on merge :) |
|
@sobolevn Hi! Could you please take a look at my PR, when you have a moment? Thanks! |
improve typing
9bb4858 to
c01e154
Compare
| case _: | ||
| ... | ||
|
|
||
| def too_many_locals(): # noqa: WPS482 |
There was a problem hiding this comment.
In test_noqa only one example is needed, here we test:
- noqa position
- full plugin integration
| 'Maximum amount of `noqa` comments per module.', | ||
| ), | ||
| _Option( | ||
| '--max-comments-in-function', |
There was a problem hiding this comment.
I don't think that it should be this simple. We should count the code / comments rate.
There might be several important cases:
- Where the amount of comments are far greater then the code, it is totally valid, if we need to explain something
- Where there are just some comments, like 1 or 2
- Where the amount of comments are zero
These cases are valid.
What cases are not that valid?
def some():
x = 1 # define x
y = 2 # define y
z = 3 # define z
return x + y # return their sumWe should also ignore type: comments, # noqa comments, # pyright, # ty, # ruff, and # pyrefly comments.
So, basically we need to find a lot of slop code, analyze its comments and patterns, try to formalize it, ban it.
This is a very complex task :)
There was a problem hiding this comment.
Thanks for the details!
I have made things!
Checklist
CHANGELOG.mdRelated issues
🙏 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.