summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Marek <shlomme@gmail.com>2014-04-17 11:41:32 +0200
committerTorsten Marek <shlomme@gmail.com>2014-04-17 11:41:32 +0200
commitccd6318a50e7428dfeb7da74f19a332b71ba5c9c (patch)
treec4abb1ae9cc0ad3ed88b0744d8fdd791b3a72207
parent39c007ffd6e7eceee949ccecae8cb91abf28a029 (diff)
downloadpylint-ccd6318a50e7428dfeb7da74f19a332b71ba5c9c.tar.gz
Use one symbol for warning about deprecated pragmas.
-rw-r--r--lint.py22
-rw-r--r--test/messages/func_i0014.txt2
-rw-r--r--test/messages/func_i0022.txt10
3 files changed, 15 insertions, 19 deletions
diff --git a/lint.py b/lint.py
index ebf3a1f..49eea73 100644
--- a/lint.py
+++ b/lint.py
@@ -116,12 +116,6 @@ MSGS = {
'I0013': ('Ignoring entire file',
'file-ignored',
'Used to inform that the file will not be checked'),
- 'I0014': ('Used deprecated directive "pylint:disable-all" or '
- '"pylint:disable=all"',
- 'deprecated-disable-all',
- 'You should preferably use "pylint:skip-file" as this directive '
- 'has a less confusing name. Do this only if you are sure that '
- 'all people running Pylint on your code have version >= 0.26'),
'I0020': ('Suppressed %s (from line %d)',
'suppressed-message',
'A message was triggered on a line, but suppressed explicitly '
@@ -132,11 +126,12 @@ MSGS = {
'useless-suppression',
'Reported when a message is explicitly disabled for a line or '
'a block of code, but never triggered.'),
- 'I0022': ('Deprecated pragma "pylint:disable-msg" or "pylint:enable-msg"',
+ 'I0022': ('Pragma "%s" is deprecated, use "%s" instead',
'deprecated-pragma',
- 'You should preferably use "pylint:disable" or "pylint:enable" '
- 'instead of the deprecated suppression pragma style '
- '"pylint:disable-msg" or "pylint:enable-msg"'),
+ 'Some inline pylint options have been renamed or reworked, '
+ 'only the most recent form should be used. '
+ 'NOTE:skip-all is only available with pylint >= 0.26',
+ {'old_names': [('I0014', 'deprecated-disable-all')]}),
'E0001': ('%s',
'syntax-error',
@@ -469,7 +464,8 @@ warning, statement which respectively contain the number of errors / warnings\
if match.group(1).strip() == "disable-all" or \
match.group(1).strip() == 'skip-file':
if match.group(1).strip() == "disable-all":
- self.add_message('deprecated-disable-all', line=start[0])
+ self.add_message('deprecated-pragma', line=start[0],
+ args=('disable-all', 'skip-file'))
self.add_message('file-ignored', line=start[0])
self._ignore_file = True
return
@@ -486,11 +482,11 @@ warning, statement which respectively contain the number of errors / warnings\
except KeyError:
meth = self._bw_options_methods[opt]
# found a "(dis|en)able-msg" pragma deprecated suppresssion
- self.add_message('deprecated-pragma', line=start[0])
+ self.add_message('deprecated-pragma', line=start[0], args=(opt, opt.replace('-msg', '')))
for msgid in splitstrip(value):
try:
if (opt, msgid) == ('disable', 'all'):
- self.add_message('deprecated-disable-all', line=start[0])
+ self.add_message('deprecated-pragma', line=start[0], args=('disable=all', 'skip-file'))
self.add_message('file-ignored', line=start[0])
self._ignore_file = True
return
diff --git a/test/messages/func_i0014.txt b/test/messages/func_i0014.txt
index d179cd1..c3b521d 100644
--- a/test/messages/func_i0014.txt
+++ b/test/messages/func_i0014.txt
@@ -1,2 +1,2 @@
I: 1: Ignoring entire file
-I: 1: Used deprecated directive "pylint:disable-all" or "pylint:disable=all"
+I: 1: Pragma "disable-all" is deprecated, use "skip-file" instead
diff --git a/test/messages/func_i0022.txt b/test/messages/func_i0022.txt
index 471b8e3..ddcb066 100644
--- a/test/messages/func_i0022.txt
+++ b/test/messages/func_i0022.txt
@@ -1,12 +1,12 @@
I: 5: Locally disabling invalid-name (C0103)
I: 5: Suppressed 'invalid-name' (from line 5)
-I: 6: Deprecated pragma "pylint:disable-msg" or "pylint:enable-msg"
+I: 6: Pragma "disable-msg" is deprecated, use "disable" instead
I: 6: Suppressed 'invalid-name' (from line 6)
I: 9: Suppressed 'invalid-name' (from line 8)
-I: 12: Deprecated pragma "pylint:disable-msg" or "pylint:enable-msg"
+I: 12: Pragma "disable-msg" is deprecated, use "disable" instead
I: 13: Suppressed 'invalid-name' (from line 12)
-I: 14: Deprecated pragma "pylint:disable-msg" or "pylint:enable-msg"
-I: 16: Deprecated pragma "pylint:disable-msg" or "pylint:enable-msg"
+I: 14: Pragma "enable-msg" is deprecated, use "enable" instead
+I: 16: Pragma "disable-msg" is deprecated, use "disable" instead
I: 17: Suppressed 'invalid-name' (from line 16)
-I: 18: Deprecated pragma "pylint:disable-msg" or "pylint:enable-msg"
+I: 18: Pragma "enable-msg" is deprecated, use "enable" instead
I: 21: Suppressed 'invalid-name' (from line 20)