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

Allow noqa for all line checks #480

Closed
IanLee1521 opened this issue Feb 17, 2016 · 10 comments
Closed

Allow noqa for all line checks #480

IanLee1521 opened this issue Feb 17, 2016 · 10 comments

Comments

@IanLee1521
Copy link
Member

Up front, there has been a lot of discussion about this topic in issues (including but not limited to): #28 #180 #231 #376 #381 #472.

With the two largest types of responses having been: "yes this definitely needs to be a feature" and "users should not add this much noise to their code".

I've thought about it quite a bit, and I believe that as a tool, it should be up to the user / developer to decide when it is appropriate to use these disables. Therefore I am creating this issue as a target to produce a pull request allowing noqa for any lines in a file / for all classes of errors, and will be closing the other issues which have (at least generally) not produced pull requests.

Note that at a minimum, any pull request being considered should: pass all the tests, update the documentation accordingly, add no additional dependencies, and add no significant overhead to the performance of the code. With the stickiness of this issue, and the variety of feelings on the matter, expect that any proposed pull requests will likely get a good deal of scrutiny.

@sigmavirus24
Copy link
Member

I already have plans for this + something fancier in Flake8 3.0. pep8 might be able to piggy-back off of that once I've released it instead of anyone needing to work on it in here.

@IanLee1521
Copy link
Member Author

Awesome! 👍

@jaredj
Copy link

jaredj commented Sep 14, 2017

@sigmavirus24 did you ever wind up doing this for flake8? 3.3.0 seems to ignore many / most # noqa comments with specific error codes in them.

In our use case, we have a big body of code with pep8 errors and will eventually audit it but at the moment we want to ignore many existing violations without letting new violations of the same category slide.

@sigmavirus24
Copy link
Member

@jaredj
Copy link

jaredj commented Sep 15, 2017

@sigmavirus24 I am, but with flake8 3.3.0, after adding all the lines, only a small subset of errors are ignored; about 3,400 out of 3,800 errors still show up. I thought this was expected behavior based on #180

@sigmavirus24
Copy link
Member

Are you using Flake8 or pycodestyle? Flake8 will ignore them. pycodestyle doesn't have that level of support

@danie1k
Copy link

danie1k commented Oct 11, 2019

Any updates on this topic?

@sigmavirus24
Copy link
Member

@danie1k Flake8 has support to # noqa any error along with allowing you to ignore a specific error on a line. I'm closing this out

@jeanmonet
Copy link

Sooo, in 2021 approaching 2022 is it possible to do something like:

print("Hi pycodestyle",   "please ignore E241 warning on this specific line")    # noqa: E241
#                      ^^^

I cannot find this in the documentation? And currently this doesn't seem to work :(

@sigmavirus24
Copy link
Member

If you're using Flake8, that works perfectly, yes.

@PyCQA PyCQA locked and limited conversation to collaborators Nov 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants