-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Prevent useless-suppression
on disables for stdlib deprecation checker
#5876
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
Changes from 14 commits
5c0553c
59e0776
9822f2f
c59fd92
ec363bf
5fc47f1
f2b9513
67517b6
49bacad
373ad24
b499494
1a76f07
b4e7c21
68d3565
d0ff997
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,3 +173,13 @@ class DeletedMessage(NamedTuple): | |
# https://github.com/PyCQA/pylint/pull/3571 | ||
DeletedMessage("C0330", "bad-continuation"), | ||
] | ||
|
||
|
||
INCOMPATIBLE_WITH_USELESS_SUPPRESSION = [ | ||
"R0401", # cyclic-import | ||
"W0402", # deprecated-module | ||
"W1505", # deprecated-method | ||
"W1511", # deprecated-argument | ||
"W1512", # deprecated-class | ||
"W1513", # deprecated-decorator | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering how hard it would be to still raise useless-suppression if the function/class/module/decorator... is not deprecated in any python version. I don't think this checker is very performance intensive, maybe relaunching with the highest python version (3.10 right now) is possible ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Though about something similar, but in the context of a bare
Not sure that is practical. It would almost certainly change major parts of the application flow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cdce8p I like your last suggestion! |
||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"""Test that versions below Py3.10 will not emit useless-suppression for | ||
disabling deprecated-method (on a method deprecated in Py3.10. | ||
|
||
This test can be run on all Python versions, but it will lack value when | ||
Pylint drops support for 3.9.""" | ||
# pylint: disable=import-error, unused-import | ||
|
||
import threading.current_thread # pylint: disable=deprecated-method |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Test deprecated methods from Python 3.9.""" | ||
|
||
import binascii | ||
binascii.b2a_hqx() # [deprecated-method] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[testoptions] | ||
min_pyver=3.9 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deprecated-method:4:0:4:18::Using deprecated method b2a_hqx():UNDEFINED |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
deprecated-module:4:::Uses of a deprecated module 'optparse' | ||
deprecated-module:4:0:4:15::Uses of a deprecated module 'optparse':UNDEFINED |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Test deprecated modules from Python 3.9.""" | ||
# pylint: disable=unused-import | ||
|
||
import binhex # [deprecated-module] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[testoptions] | ||
min_pyver=3.9 | ||
|
||
[Messages Control] | ||
enable=deprecated-module | ||
cdce8p marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deprecated-module:4:0:4:13::Uses of a deprecated module 'binhex':UNDEFINED |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"""Test deprecated modules from Python 3.9, | ||
but use an earlier --py-version and ensure a warning is still emitted. | ||
""" | ||
# pylint: disable=unused-import | ||
|
||
import binhex # [deprecated-module] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[master] | ||
py-version=3.8 | ||
|
||
[testoptions] | ||
min_pyver=3.9 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deprecated-module:6:0:6:13::Uses of a deprecated module 'binhex':UNDEFINED |
Uh oh!
There was an error while loading. Please reload this page.