-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Python: take into account suppression comments such as noqa:E123 #6528
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
Conversation
While it would be best to match Python suppression comments and CodeQL suppression comments, in the short term this will avoid false positives. Takes into account pycodestyle error codes (both E and W): https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes Takes into account flake8 errors codes (F) but not mccabe (C): https://flake8.pycqa.org/en/latest/user/error-codes.html
|
Thank you for your submission. Unfortunately, we cannot accept this PR, as it would allow a relatively low severity For your use case, would it not be sufficient to add |
|
Adding different suppression comments for each linter is not a solution: one suppression comment for LGTM.com, one for codespell, one for flake8, one for Coverity, and so on... We'll end up with mores suppression comments than actual code. The standard for Python is I need to stress that because of the lack of decent support of In effect, in this specific context, the effect of LGTM.com is lower security. |
|
I can understand your frustration. It would be great if there was a universally agreed-upon scheme for specifying suppression comments. (Though I would personally prefer one that conveyed a bit more information than just a number that one would then have to go look up elsewhere.) In that case, my best suggestion to you would be to change the existing I understand that this is likely not the answer you're looking for, but what you're suggesting (though only a minor change) has a fairly big impact on how alert suppression works. Other users may be relying on the fact that specific |
|
I have changed the relevant code to However, I'm not certain you fully understand the effect of this change. To use your own words, "what you're suggesting (though only a minor change) has a fairly big impact on how alert suppression works":
On one hand, we'd like to address LGTM alerts, because LGTM push to become some sort of bug authority, and projects don't want to be pointed at - especially in case of false positives. On the other hand, fixing LGTM alerts by changing I'll look into the |
|
Besides, it looks like a simple |
|
I can understand why you cannot accept the patch, your priority is not the efficiency of the whole ecosystem around Python and overall Python code quality, your priority is the precision of LGTM alerts by themselves. These two targets do not necessarily align, and they don't have to. It is up to end users to find solutions to work around false positives, without sacrificing code quality. Perhaps this discussion should have taken place in issue #6517, which should remain open until The problem of the lone |
|
The comment not taken into account mentioned above is easy to fix, at least. One way to do it is here: #6570 |
While it would be best to match Python suppression comments and CodeQL
suppression comments, in the short term this will avoid false positives.
Takes into account pycodestyle error codes (both
EandW):https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
Does not take into account flake8/mccabe errors codes (
FandC):https://flake8.pycqa.org/en/latest/user/error-codes.html
Fixes #6517.