summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2015-08-20 17:00:25 +0300
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2015-08-20 17:00:25 +0300
commit4e4311ef7375d6311b30807895a7531120ee83f7 (patch)
tree7cad25724f799a5589f7cbf1dab5ef688c671563
parentc1ffe31653d24c6bf05bdfa1b11cf055491c4822 (diff)
downloadpylint-4e4311ef7375d6311b30807895a7531120ee83f7.tar.gz
missing-module-attribute was removed and the corresponding CLI option, required-attributes, is slated for removal in Pylint 1.6.
-rw-r--r--ChangeLog4
-rw-r--r--pylint/checkers/base.py18
-rw-r--r--pylint/test/functional/anomalous_unicode_escape_py2.py2
-rw-r--r--pylint/test/functional/anomalous_unicode_escape_py3.py2
-rw-r--r--pylint/test/input/func_kwoa_py30.py2
-rw-r--r--pylint/test/input/func_noerror_crash_122793.py1
-rw-r--r--pylint/test/input/func_noerror_crash_127416.py2
-rw-r--r--pylint/test/input/func_noerror_used_before_assignment.py2
-rw-r--r--pylint/test/unittest_lint.py18
9 files changed, 22 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c9c284..f619130 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -249,6 +249,10 @@ ChangeLog for Pylint
At the same time, --include-ids and --symbols will also be removed
in Pylint 1.6. Closes issue #570.
+
+ * missing-module-attribute was removed and the corresponding
+ CLI option, required-attributes, which is slated for removal
+ in Pylint 1.6.
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py
index f698016..11f0b1d 100644
--- a/pylint/checkers/base.py
+++ b/pylint/checkers/base.py
@@ -33,7 +33,7 @@ from astroid import are_exclusive, InferenceError
from astroid import helpers
from pylint.interfaces import IAstroidChecker, INFERENCE, INFERENCE_FAILURE, HIGH
-from pylint.utils import EmptyReport
+from pylint.utils import EmptyReport, deprecated_option
from pylint.reporters import diff_string
from pylint.checkers import BaseChecker
from pylint.checkers.utils import (
@@ -604,10 +604,6 @@ functions, methods
'Emitted when a conditional statement (If or ternary if) '
'uses a constant value for its test. This might not be what '
'the user intended to do.'),
- 'C0121': ('Missing required attribute "%s"', # W0103
- 'missing-module-attribute',
- 'Used when an attribute required for modules is missing.'),
-
'E0109': ('Missing argument to reversed()',
'missing-reversed-argument',
'Used when reversed() builtin didn\'t receive an argument.'),
@@ -620,11 +616,9 @@ functions, methods
}
options = (('required-attributes',
- {'default' : (), 'type' : 'csv',
- 'metavar' : '<attributes>',
- 'help' : 'Required attributes for module, separated by a '
- 'comma'}
- ),
+ deprecated_option(opt_type='csv',
+ help_msg="Required attributes for module")),
+
('bad-functions',
{'default' : BAD_FUNCTIONS,
'type' :'csv', 'metavar' : '<builtin function names>',
@@ -686,14 +680,10 @@ functions, methods
if emit or isinstance(inferred, const_nodes):
self.add_message('using-constant-test', node=node)
- @check_messages('missing-module-attribute')
def visit_module(self, node):
"""check module name, docstring and required arguments
"""
self.stats['module'] += 1
- for attr in self.config.required_attributes:
- if attr not in node:
- self.add_message('missing-module-attribute', node=node, args=attr)
def visit_class(self, node): # pylint: disable=unused-argument
"""check module name, docstring and redefinition
diff --git a/pylint/test/functional/anomalous_unicode_escape_py2.py b/pylint/test/functional/anomalous_unicode_escape_py2.py
index 19a6912..8f304fa 100644
--- a/pylint/test/functional/anomalous_unicode_escape_py2.py
+++ b/pylint/test/functional/anomalous_unicode_escape_py2.py
@@ -1,4 +1,4 @@
-# pylint:disable=W0105, W0511, C0121
+# pylint:disable=W0105, W0511
"""Test for backslash escapes in byte vs unicode strings"""
# Would be valid in Unicode, but probably not what you want otherwise
diff --git a/pylint/test/functional/anomalous_unicode_escape_py3.py b/pylint/test/functional/anomalous_unicode_escape_py3.py
index 1588ca0..b8bfd0a 100644
--- a/pylint/test/functional/anomalous_unicode_escape_py3.py
+++ b/pylint/test/functional/anomalous_unicode_escape_py3.py
@@ -1,4 +1,4 @@
-# pylint:disable=W0105, W0511, C0121
+# pylint:disable=W0105, W0511
"""Test for backslash escapes in byte vs unicode strings"""
# Would be valid in Unicode, but probably not what you want otherwise
diff --git a/pylint/test/input/func_kwoa_py30.py b/pylint/test/input/func_kwoa_py30.py
index 4be5302..a5fe07c 100644
--- a/pylint/test/input/func_kwoa_py30.py
+++ b/pylint/test/input/func_kwoa_py30.py
@@ -1,4 +1,4 @@
-# pylint: disable=C0121, C0102
+# pylint: disable=C0102
'''A little testscript for PEP 3102 and pylint'''
def function(*, foo):
'''A function for testing'''
diff --git a/pylint/test/input/func_noerror_crash_122793.py b/pylint/test/input/func_noerror_crash_122793.py
index 2bb3d2e..71c138a 100644
--- a/pylint/test/input/func_noerror_crash_122793.py
+++ b/pylint/test/input/func_noerror_crash_122793.py
@@ -1,4 +1,3 @@
-# pylint: disable=C0121
"""https://www.logilab.org/ticket/122793"""
def gen():
diff --git a/pylint/test/input/func_noerror_crash_127416.py b/pylint/test/input/func_noerror_crash_127416.py
index 3a04363..6c30a79 100644
--- a/pylint/test/input/func_noerror_crash_127416.py
+++ b/pylint/test/input/func_noerror_crash_127416.py
@@ -1,4 +1,4 @@
-# pylint: disable=C0111,R0201,C0121
+# pylint: disable=C0111,R0201
"""
FUNCTIONALITY
"""
diff --git a/pylint/test/input/func_noerror_used_before_assignment.py b/pylint/test/input/func_noerror_used_before_assignment.py
index 67dd128..ec7643b 100644
--- a/pylint/test/input/func_noerror_used_before_assignment.py
+++ b/pylint/test/input/func_noerror_used_before_assignment.py
@@ -1,4 +1,4 @@
-# pylint: disable = line-too-long, multiple-statements, missing-module-attribute
+# pylint: disable = line-too-long, multiple-statements
"""https://bitbucket.org/logilab/pylint/issue/111/false-positive-used-before-assignment-with"""
from __future__ import print_function
try: raise IOError(1, "a")
diff --git a/pylint/test/unittest_lint.py b/pylint/test/unittest_lint.py
index f95db3a..77b88ab 100644
--- a/pylint/test/unittest_lint.py
+++ b/pylint/test/unittest_lint.py
@@ -245,32 +245,32 @@ class PyLinterTC(unittest.TestCase):
def test_enable_message_category(self):
linter = self.init_linter()
self.assertTrue(linter.is_message_enabled('W0101'))
- self.assertTrue(linter.is_message_enabled('C0121'))
+ self.assertTrue(linter.is_message_enabled('C0202'))
linter.disable('W', scope='package')
linter.disable('C', scope='module', line=1)
self.assertFalse(linter.is_message_enabled('W0101'))
- self.assertTrue(linter.is_message_enabled('C0121'))
- self.assertFalse(linter.is_message_enabled('C0121', line=1))
+ self.assertTrue(linter.is_message_enabled('C0202'))
+ self.assertFalse(linter.is_message_enabled('C0202', line=1))
linter.set_current_module('tutu')
self.assertFalse(linter.is_message_enabled('W0101'))
- self.assertTrue(linter.is_message_enabled('C0121'))
+ self.assertTrue(linter.is_message_enabled('C0202'))
linter.enable('W', scope='package')
linter.enable('C', scope='module', line=1)
self.assertTrue(linter.is_message_enabled('W0101'))
- self.assertTrue(linter.is_message_enabled('C0121'))
- self.assertTrue(linter.is_message_enabled('C0121', line=1))
+ self.assertTrue(linter.is_message_enabled('C0202'))
+ self.assertTrue(linter.is_message_enabled('C0202', line=1))
def test_message_state_scope(self):
class FakeConfig(object):
confidence = ['HIGH']
linter = self.init_linter()
- linter.disable('C0121')
+ linter.disable('C0202')
self.assertEqual(MSG_STATE_SCOPE_CONFIG,
- linter.get_message_state_scope('C0121'))
+ linter.get_message_state_scope('C0202'))
linter.disable('W0101', scope='module', line=3)
self.assertEqual(MSG_STATE_SCOPE_CONFIG,
- linter.get_message_state_scope('C0121'))
+ linter.get_message_state_scope('C0202'))
self.assertEqual(MSG_STATE_SCOPE_MODULE,
linter.get_message_state_scope('W0101', 3))
linter.enable('W0102', scope='module', line=3)