Skip to content

add TooManyComments (#3689) - #3695

Open
Khabib73 wants to merge 1 commit into
wemake-services:masterfrom
Khabib73:feat/add-violation
Open

add TooManyComments (#3689)#3695
Khabib73 wants to merge 1 commit into
wemake-services:masterfrom
Khabib73:feat/add-violation

Conversation

@Khabib73

@Khabib73 Khabib73 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

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

🙏 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.

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2f861ec) to head (c01e154).

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.
📢 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.

@Khabib73

Khabib73 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

I'll squash the commits at the end, please don't squash on merge :)

@Khabib73

Khabib73 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

@sobolevn Hi! Could you please take a look at my PR, when you have a moment? Thanks!

@Khabib73
Khabib73 force-pushed the feat/add-violation branch from 9bb4858 to c01e154 Compare July 3, 2026 13:06
case _:
...

def too_many_locals(): # noqa: WPS482

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 sum

We 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 :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the details!

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.

add TooManyCommentsViolation

2 participants