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

Incorrect NQA102 error #21

Closed
nkakouros opened this issue Feb 6, 2023 · 5 comments
Closed

Incorrect NQA102 error #21

nkakouros opened this issue Feb 6, 2023 · 5 comments

Comments

@nkakouros
Copy link

I have a library file that I am checking with vulture. For a function that I define in there, I get the following error from vulture:

my-lib.py:12: unused function 'method-name' (60% confidence)

I can silence this with noqa VT103. But then flake8-noqa will complain:

NQA102 "# noqa: VT103" has no matching violations
@stefan6419846
Copy link

Isn't this duplicated by the (more detailed) #22?

@nkakouros
Copy link
Author

Isn't this duplicated by the (more detailed) #22?

No, this is about the false positive. Issue #22 is about silencing NQA errors.

@plinss
Copy link
Owner

plinss commented Feb 7, 2023

This is likely a duplicate of #2. This happens when the plugin itself respects # noqa comments and stops sending the error to flake8. This is an anti-pattern and the proper behavior is for the plugin to just send it's errors regardless and trust flake8 to do the suppression.

If you're using vulture stand-alone, then flake8 and by extension flake8-noqa will never see the error and so will always complain. The ideal fix here is to use vultureas a flake8-plugin (which may require someone writing a plugin) and adding a switch to vulture to ignore # noqa comments when used as a plugin.

@nkakouros
Copy link
Author

I see. I found this issue on vulture's issue tracker where they discussed making vulture a flake8 plugin, but this required support from upstream flake8 which was hostile to the idea. Does this mean that the only way forward for vulture users is #22?

@plinss
Copy link
Owner

plinss commented Feb 7, 2023

Yes, if the errors aren't reported through flake8, there's no way for flake8-noqa to know if an error exists on a line or not.

I'm going to close this issue and give some thought to #22, at this point I'm thinking a config option to specify codes to ignore NQA102 errors on (I'd rather not add any additional info to the comments). It'll also help as a work around for plugins that do their own # noqa processing.

@plinss plinss closed this as completed Feb 7, 2023
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

No branches or pull requests

3 participants