diff options
| author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-05-05 12:16:50 +0300 |
|---|---|---|
| committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-05-05 12:16:50 +0300 |
| commit | a76e32c89588be85f24b21fcdd23604e2ea9ce99 (patch) | |
| tree | d08b1458c8a6cd2013f0a6edeb598f48c5b9b575 | |
| parent | 68fee0184aa4aa45f64f287b44ab940e7d3fb730 (diff) | |
| download | pylint-a76e32c89588be85f24b21fcdd23604e2ea9ce99.tar.gz | |
Make ignore-iface-methods a noop option, mark it as deprecated.
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | pylint/checkers/classes.py | 20 | ||||
| -rw-r--r-- | pylint/lint.py | 13 | ||||
| -rw-r--r-- | pylint/utils.py | 16 |
4 files changed, 26 insertions, 26 deletions
@@ -89,7 +89,8 @@ ChangeLog for Pylint * Remove the rest of interface checks: interface-is-not-class, missing-interface-method, unresolved-interface. The reason is that its better to start recommending ABCs instead of the old Zope era - of interfaces. + of interfaces. One side effect of this change is that ignore-iface-methods + becomes a noop, it's deprecated and it will be removed at some time. 2015-03-14 -- 1.4.3 diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 007cb42..146fd01 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -32,6 +32,7 @@ from pylint.checkers.utils import ( PYMETHODS, overrides_a_method, check_messages, is_attr_private, is_attr_protected, node_frame_class, safe_infer, is_builtin_object, decorated_with_property, unimplemented_abstract_methods) +from pylint.utils import deprecated_option import six if sys.version_info >= (3, 0): @@ -250,21 +251,10 @@ class ClassChecker(BaseChecker): priority = -2 # configuration options options = (('ignore-iface-methods', - {'default' : (#zope interface - 'isImplementedBy', 'deferred', 'extends', 'names', - 'namesAndDescriptions', 'queryDescriptionFor', 'getBases', - 'getDescriptionFor', 'getDoc', 'getName', 'getTaggedValue', - 'getTaggedValueTags', 'isEqualOrExtendedBy', 'setTaggedValue', - 'isImplementedByInstancesOf', - # twisted - 'adaptWith', - # logilab.common interface - 'is_implemented_by'), - 'type' : 'csv', - 'metavar' : '<method names>', - 'help' : 'List of interface methods to ignore, \ -separated by a comma. This is used for instance to not check methods defines \ -in Zope\'s Interface base class.'} + # TODO(cpopa): remove this in Pylint 1.7. + deprecated_option(opt_type="csv", + help_msg="This is deprecated, because " + "it is not used anymore.") ), ('defining-attr-methods', {'default' : ('__init__', '__new__', 'setUp'), diff --git a/pylint/lint.py b/pylint/lint.py index ec03420..46b2c14 100644 --- a/pylint/lint.py +++ b/pylint/lint.py @@ -204,13 +204,6 @@ MSGS = { } -def _deprecated_option(shortname, opt_type, help_msg): - def _warn_deprecated(option, optname, *args): # pylint: disable=unused-argument - sys.stderr.write('Warning: option %s is deprecated and ignored.\n' % (optname,)) - return {'short': shortname, 'help': help_msg, 'hide': True, - 'type': opt_type, 'action': 'callback', 'callback': _warn_deprecated} - - if multiprocessing is not None: class ChildLinter(multiprocessing.Process): # pylint: disable=no-member def run(self): @@ -389,9 +382,9 @@ class PyLinter(configuration.OptionsManagerMixIn, 'See doc for all details') }), - ('include-ids', _deprecated_option('i', 'yn', - INCLUDE_IDS_HELP)), - ('symbols', _deprecated_option('s', 'yn', SYMBOLS_HELP)), + ('include-ids', utils.deprecated_option( + 'i', 'yn', INCLUDE_IDS_HELP)), + ('symbols', utils.deprecated_option('s', 'yn', SYMBOLS_HELP)), ('jobs', {'type' : 'int', 'metavar': '<n-processes>', diff --git a/pylint/utils.py b/pylint/utils.py index c91497a..d2c9ed8 100644 --- a/pylint/utils.py +++ b/pylint/utils.py @@ -925,3 +925,19 @@ def get_global_option(checker, option, default=None): if options[0] == option: return getattr(provider.config, option.replace("-", "_")) return default + + +def deprecated_option(shortname=None, opt_type=None, help_msg=None): + def _warn_deprecated(option, optname, *args): # pylint: disable=unused-argument + sys.stderr.write('Warning: option %s is deprecated and ignored.\n' % (optname,)) + + option = { + 'help': help_msg, + 'hide': True, + 'type': opt_type, + 'action': 'callback', + 'callback': _warn_deprecated + } + if shortname: + option['shortname'] = shortname + return option |
