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

Disallow to ignore some violations on line level #1248

Closed
sobolevn opened this issue Mar 8, 2020 · 4 comments · Fixed by #1347
Closed

Disallow to ignore some violations on line level #1248

sobolevn opened this issue Mar 8, 2020 · 4 comments · Fixed by #1347
Assignees
Labels
help wanted Extra attention is needed level:starter Good for newcomers pr-available rule request Adding a new rule

Comments

@sobolevn
Copy link
Member

sobolevn commented Mar 8, 2020

Rule request

Thesis

Sometimes developers inline ignore violations that should not be ignored. Like complexity violations, best practices, or any others that are important for this specific project.

So, we need to give users an option to provide a configuration hook with violations names (both short like WPS and full ones like WPS102) that cannot be ignored.

And when we find inline ignore of this violations - we should raise a new one on 0 line.

We do not check per-file-ignores and ignored with this check.

Related: https://github.com/wemake-services/wemake-python-styleguide/pull/1246/files#diff-2c42a0740c36d757ff4d489010b3138eR4

This is a best practices violation.

@sobolevn sobolevn added help wanted Extra attention is needed level:starter Good for newcomers rule request Adding a new rule labels Mar 8, 2020
@sobolevn sobolevn added this to the Version 0.15 milestone Mar 8, 2020
@edytagarbarz
Copy link
Contributor

Hi, let me work on this!

@sobolevn
Copy link
Member Author

@edytagarbarz you are welcome!

@webknjaz
Copy link
Contributor

I have a case where I'm temporarily patching some other project and have a copy-pasted function that I edit (until the upstream releases a fix).
That function causes WPS231 Found too high function cognitive complexity: 13 > 12 and I don't really want to rewrite it keeping it as close to the original as possible.

What is the advice here if I cannot ignore this inline?

@sobolevn
Copy link
Member Author

I am using quite similar idea in #1276
I just ignore patches/ folder for any complexity violation there is.

@sobolevn sobolevn modified the milestones: Version 0.16, Version 0.15 aka New runtime Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed level:starter Good for newcomers pr-available rule request Adding a new rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants