-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix typo in pylintrc for useless-suppression #5303
Conversation
Pull Request Test Coverage Report for Build 1494784110
π - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π
@Pierre-Sassoulas Isn't this supposed to show some useless suppressions in our current code? I remember I saw some errors previously. Did we fix those in another pr? |
Hmm, I don't think so, there must be something wrong with the way we launch pylint in github actions because: pylint pylint/ --enable=all|grep useless
|
Try adding the |
Ho is this the issue where |
We discussed it here: pylint-dev/astroid#1217 (comment). As I pointed out then we should not emit a non-zero exit code for
|
I added a fix with allows failing on It requires changing how @cdce8p Our CI takes into account our This requires careful thought, but I think we might be fine by adding this. If agreed I will fix the outstanding useless-suppression warnings as well so this can go in |
Isn't this is a good thing and a way to find problem with |
I guess we'll find out if it works. It was one of the reasons to add such a setting in the first place. Might be that my reservations are unfound. |
.pre-commit-config.yaml
Outdated
"--fail-under=10", | ||
"--evaluation='10.0 - ((float(5 * error + warning + refactor + convention + | ||
info) / statement) * 10)'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use --fail-on=useless-suppression
instead?
Maybe --fail-on=I
works π€·π»ββοΈ haven't tested it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--fail-on
works, forgot that was a thing!
@@ -74,9 +74,9 @@ def _collect_block_lines( | |||
# | |||
# 1. def meth8(self): | |||
# 2. """test late disabling""" | |||
# 3. pylint: disable=not-callable | |||
# 3. pylint: disable=not-callable, useless-suppression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the most elegant way to allow us to still fail on I
.
This does indeed create issues π’ On |
It's kinda true though, as the AST changed in python 3.8, if you need to work on proper column index for messages you need 3.8+ (functional tests will help you but you will need to check the expected column by running github actions and you won't be able to update the column automatically). So maybe we could upgrade the interpreter we use for pre-commit to 3.8 and upgrade the contributor documentation accordingly. |
Up until just recently my goto recommendation would have been to use the oldest supported Python version at least for |
Shouldn't those still fail in the regular test suite? To make sure this PR doesn't stay open indefinitely I propose to:
I think because of the aforementioned change to the |
Yes, we still run all tests on 3.6 / 3.7 we'd catch the real error. Whatever we do automated tests are still better than static analysis π
π |
@@ -21,7 +21,7 @@ | |||
def _cpu_count() -> int: | |||
"""Use sched_affinity if available for virtualized or containerized environments.""" | |||
sched_getaffinity = getattr(os, "sched_getaffinity", None) | |||
# pylint: disable=not-callable,using-constant-test | |||
# pylint: disable=not-callable,using-constant-test,useless-suppression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unsolvable atm. The pre-commit
env does have sched_getaffinity
so this will always create some sort of error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
@@ -93,7 +93,7 @@ def normalize_text(text, line_len=DEFAULT_LINE_LENGTH, indent=""): | |||
|
|||
|
|||
# py3k has no more cmp builtin | |||
def cmp(a, b): # pylint: disable=redefined-builtin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was useless since pylint 2.0 π
Co-authored-by: Pierre Sassoulas <[email protected]>
Type of Changes
Description
Closes #5040
See discussion there.