diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2010-04-19 11:18:08 +0200 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2010-04-19 11:18:08 +0200 |
commit | cefa5131bc24376108431ff0db404b30f94637bf (patch) | |
tree | c5c4349e811ba70cd44ea262176a2556709a983c | |
parent | 45d7af410711749b669c5a363fd9978629b50d1b (diff) | |
download | pylint-cefa5131bc24376108431ff0db404b30f94637bf.tar.gz |
use generic disable / enable methods and inline option
83 files changed, 125 insertions, 135 deletions
diff --git a/__pkginfo__.py b/__pkginfo__.py index 2da0a54..b1bc3e3 100644 --- a/__pkginfo__.py +++ b/__pkginfo__.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=W0622,C0103 +# pylint: disable=W0622,C0103 # Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # diff --git a/checkers/classes.py b/checkers/classes.py index 22d7f63..52b76df 100644 --- a/checkers/classes.py +++ b/checkers/classes.py @@ -316,7 +316,7 @@ instance attributes.'} # XXX refactor, probably much simpler now that E0201 is in type checker for attr, nodes in accessed.items(): # deactivate "except doesn't do anything", that's expected - # pylint: disable-msg=W0704 + # pylint: disable=W0704 # is it a class attribute ? try: node.local_attr(attr) diff --git a/checkers/misc.py b/checkers/misc.py index daafc89..4f01992 100644 --- a/checkers/misc.py +++ b/checkers/misc.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=W0511 +# pylint: disable=W0511 # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later diff --git a/checkers/similar.py b/checkers/similar.py index 60a6ec0..2b342a8 100644 --- a/checkers/similar.py +++ b/checkers/similar.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=W0622 +# pylint: disable=W0622 # Copyright (c) 2004-2006 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # @@ -80,7 +80,7 @@ class Similar: couples.sort() for lineset, idx in couples: print "==%s:%s" % (lineset.name, idx) - # pylint: disable-msg=W0631 + # pylint: disable=W0631 for line in lineset._real_lines[idx:idx+num]: print " ", line, nb_lignes_dupliquees += num * (len(couples)-1) @@ -286,14 +286,14 @@ class SimilarChecker(BaseChecker, Similar): for lineset, idx in couples: msg.append("==%s:%s" % (lineset.name, idx)) msg.sort() - # pylint: disable-msg=W0631 + # pylint: disable=W0631 for line in lineset._real_lines[idx:idx+num]: msg.append(line.rstrip()) self.add_message('R0801', args=(len(couples), '\n'.join(msg))) duplicated += num * (len(couples) - 1) stats['nb_duplicated_lines'] = duplicated stats['percent_duplicated_lines'] = total and duplicated * 100. / total - + def register(linter): """required method to auto register this checker """ diff --git a/checkers/utils.py b/checkers/utils.py index 740df6a..1d8b1f3 100644 --- a/checkers/utils.py +++ b/checkers/utils.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=W0611 +# pylint: disable=W0611 # # Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr @@ -439,9 +439,9 @@ This is used by the global evaluation report (R0004).'}), # # 1. def meth8(self): # 2. """test late disabling""" - # 3. # pylint: disable-msg=E1102 + # 3. # pylint: disable=E1102 # 4. print self.blip - # 5. # pylint: disable-msg=E1101 + # 5. # pylint: disable=E1101 # 6. print self.bla # # E1102 should be disabled from line 1 to 6 while E1101 from line 5 to 6 @@ -850,7 +850,7 @@ status 1 to 16 will be bit-ORed so you can know which different categories has been issued by analysing pylint output status code ''', level=2) # read configuration - linter.disable_message('W0704') + linter.disable('W0704') linter.read_config_file() # is there some additional plugins in the file configuration, in config_parser = linter._config_parser @@ -904,7 +904,7 @@ been issued by analysing pylint output status code * do not save execution information """ self.linter.disable_noerror_messages() - self.disable_message('miscellaneous') + self.linter.disable('miscellaneous') self.linter.set_option('reports', False) self.linter.set_option('persistent', False) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# pylint: disable-msg=W0404,W0622,W0704,W0613,W0152 +# pylint: disable=W0404,W0622,W0704,W0613 """Generic Setup script, takes package info from __pkginfo__.py file. :copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. diff --git a/test/input/func___name___access.py b/test/input/func___name___access.py index 25aed5c..def8674 100644 --- a/test/input/func___name___access.py +++ b/test/input/func___name___access.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903,W0142 +# pylint: disable=R0903,W0142 """test access to __name__ gives undefined member on new/old class instances but not on new/old class object """ diff --git a/test/input/func_attrs_definition_order.py b/test/input/func_attrs_definition_order.py index c605cdf..2f12a79 100644 --- a/test/input/func_attrs_definition_order.py +++ b/test/input/func_attrs_definition_order.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """yo""" __revision__ = '$I$' @@ -15,7 +15,7 @@ class Bbbb(object): __revision__ = __revision__ # no problemo marge def __getattr__(self, attr): - # pylint: disable-msg=W0201 + # pylint: disable=W0201 try: return self.__repo except AttributeError: @@ -25,7 +25,7 @@ class Bbbb(object): def catchme(self, attr): """no AttributeError catched""" - # pylint: disable-msg=W0201 + # pylint: disable=W0201 try: return self._repo except ValueError: diff --git a/test/input/func_bad_assigment_to_exception_var.py b/test/input/func_bad_assigment_to_exception_var.py index b404cb3..361c708 100644 --- a/test/input/func_bad_assigment_to_exception_var.py +++ b/test/input/func_bad_assigment_to_exception_var.py @@ -1,4 +1,4 @@ -# pylint:disable-msg=C0103 +# pylint:disable=C0103 """ho ho ho""" __revision__ = 'toto' diff --git a/test/input/func_block_disable_msg.py b/test/input/func_block_disable_msg.py index 354dff0..caf2d5b 100644 --- a/test/input/func_block_disable_msg.py +++ b/test/input/func_block_disable_msg.py @@ -1,9 +1,9 @@ -# pylint: disable-msg=C0302 -"""pylint option block-disable-msg""" +# pylint: disable=C0302 +"""pylint option block-disable""" __revision__ = None class Foo(object): - """block-disable-msg test""" + """block-disable test""" def __init__(self): pass @@ -14,34 +14,34 @@ class Foo(object): def meth2(self, arg): """and this one not""" - # pylint: disable-msg=W0613 + # pylint: disable=W0613 print self\ + "foo" def meth3(self): """test one line disabling""" # no error - print self.bla # pylint: disable-msg=E1101 + print self.bla # pylint: disable=E1101 # error print self.blop def meth4(self): """test re-enabling""" - # pylint: disable-msg=E1101 + # pylint: disable=E1101 # no error print self.bla print self.blop - # pylint: enable-msg=E1101 + # pylint: enable=E1101 # error print self.blip def meth5(self): """test IF sub-block re-enabling""" - # pylint: disable-msg=E1101 + # pylint: disable=E1101 # no error print self.bla if self.blop: - # pylint: enable-msg=E1101 + # pylint: enable=E1101 # error print self.blip else: @@ -52,14 +52,14 @@ class Foo(object): def meth6(self): """test TRY/EXCEPT sub-block re-enabling""" - # pylint: disable-msg=E1101 + # pylint: disable=E1101 # no error print self.bla try: - # pylint: enable-msg=E1101 + # pylint: enable=E1101 # error print self.blip - except UndefinedName: # pylint: disable-msg=E0602 + except UndefinedName: # pylint: disable=E0602 # no error print self.blip # no error @@ -67,7 +67,7 @@ class Foo(object): def meth7(self): """test one line block opening disabling""" - if self.blop: # pylint: disable-msg=E1101 + if self.blop: # pylint: disable=E1101 # error print self.blip else: @@ -81,7 +81,7 @@ class Foo(object): """test late disabling""" # error print self.blip - # pylint: disable-msg=E1101 + # pylint: disable=E1101 # no error print self.bla print self.blop @@ -93,18 +93,18 @@ class Foo(object): if eris: print ("In block") - # pylint: disable-msg=E1101 + # pylint: disable=E1101 # no error print self.bla print self.blu - # pylint: enable-msg=E1101 + # pylint: enable=E1101 # error print self.blip class ClassLevelMessage(object): """shouldn't display to much attributes/not enough methods messages """ - # pylint: disable-msg=R0902,R0903 + # pylint: disable=R0902,R0903 def __init__(self): self.attr1 = 1 @@ -121,7 +121,7 @@ class ClassLevelMessage(object): def too_complex_but_thats_ok(self, attr1, attr2): """THIS Method has too much branches and returns but i don't care """ - # pylint: disable-msg=R0912,R0911 + # pylint: disable=R0912,R0911 try: attr3 = attr1+attr2 except ValueError: diff --git a/test/input/func_class_access_protected_members.py b/test/input/func_class_access_protected_members.py index f588953..1bd0beb 100644 --- a/test/input/func_class_access_protected_members.py +++ b/test/input/func_class_access_protected_members.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """test external access to protected class members""" __revision__ = '' diff --git a/test/input/func_class_members.py b/test/input/func_class_members.py index fb12753..c1a7034 100644 --- a/test/input/func_class_members.py +++ b/test/input/func_class_members.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """test class members""" __revision__ = '' diff --git a/test/input/func_defining-attr-methods_order.py b/test/input/func_defining-attr-methods_order.py index 474b652..017cb1e 100644 --- a/test/input/func_defining-attr-methods_order.py +++ b/test/input/func_defining-attr-methods_order.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 ''' Test that y is defined properly, z is not. Default defining methods are __init__, diff --git a/test/input/func_dict_keys.py b/test/input/func_dict_keys.py index be2eca7..24c8b1f 100644 --- a/test/input/func_dict_keys.py +++ b/test/input/func_dict_keys.py @@ -1,5 +1,5 @@ """Check multiple key definition""" -#pylint: disable-msg=C0103 +#pylint: disable=C0103 __revision__ = 5 correct_dict = { diff --git a/test/input/func_docstring.py b/test/input/func_docstring.py index 7f28672..2a92c87 100644 --- a/test/input/func_docstring.py +++ b/test/input/func_docstring.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0201 +# pylint: disable=R0201 __revision__ = '' diff --git a/test/input/func_e0012.py b/test/input/func_e0012.py index 11ef99f..b50c9e5 100644 --- a/test/input/func_e0012.py +++ b/test/input/func_e0012.py @@ -1,4 +1,4 @@ -# pylint:enable-msg=W04044 +# pylint:enable=W04044 """check unknown option """ __revision__ = 1 diff --git a/test/input/func_e0101.py b/test/input/func_e0101.py index 9158041..a101917 100644 --- a/test/input/func_e0101.py +++ b/test/input/func_e0101.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """test __init__ return """ diff --git a/test/input/func_e0205.py b/test/input/func_e0205.py index 2bb1089..00e1c07 100644 --- a/test/input/func_e0205.py +++ b/test/input/func_e0205.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """check method hidding ancestor attribute """ diff --git a/test/input/func_e0206.py b/test/input/func_e0206.py index af32fd8..9ec01cd 100644 --- a/test/input/func_e0206.py +++ b/test/input/func_e0206.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """check for interface which are not classes""" __revision__ = None diff --git a/test/input/func_format.py b/test/input/func_format.py index 6cfbf68..638d942 100644 --- a/test/input/func_format.py +++ b/test/input/func_format.py @@ -1,4 +1,4 @@ -# pylint:disable-msg=C0103,W0104,W0105 +# pylint:disable=C0103,W0104,W0105 """Check format """ __revision__ = '' diff --git a/test/input/func_i0011.py b/test/input/func_i0011.py index d8202f3..2b2f445 100644 --- a/test/input/func_i0011.py +++ b/test/input/func_i0011.py @@ -1,4 +1,4 @@ -# pylint:disable-msg=W0404 +# pylint:disable=W0404 """check warning on local disabling """ __revision__ = 1 diff --git a/test/input/func_i0012.py b/test/input/func_i0012.py index bf52138..aa646c6 100644 --- a/test/input/func_i0012.py +++ b/test/input/func_i0012.py @@ -1,4 +1,4 @@ -# pylint:enable-msg=W0404 +# pylint:enable=W0404 """check warning on local enabling """ __revision__ = 1 diff --git a/test/input/func_interfaces.py b/test/input/func_interfaces.py index 2006074..7c0afe0 100644 --- a/test/input/func_interfaces.py +++ b/test/input/func_interfaces.py @@ -1,4 +1,4 @@ -# pylint:disable-msg=R0201 +# pylint:disable=R0201 """docstring""" __revision__ = '' diff --git a/test/input/func_method_could_be_function.py b/test/input/func_method_could_be_function.py index faf0717..c963042 100644 --- a/test/input/func_method_could_be_function.py +++ b/test/input/func_method_could_be_function.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903,R0922,W0232 +# pylint: disable=R0903,R0922,W0232 """test detection of method which could be a function""" __revision__ = None diff --git a/test/input/func_method_without_self_but_self_assignment.py b/test/input/func_method_without_self_but_self_assignment.py index e39266c..38e5914 100644 --- a/test/input/func_method_without_self_but_self_assignment.py +++ b/test/input/func_method_without_self_but_self_assignment.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """regression test: setup() leads to "unable to load module..." """ diff --git a/test/input/func_names_imported_from_module.py b/test/input/func_names_imported_from_module.py index caf7387..a3fa84f 100644 --- a/test/input/func_names_imported_from_module.py +++ b/test/input/func_names_imported_from_module.py @@ -1,4 +1,4 @@ -#pylint: disable-msg=W0401,W0611 +#pylint: disable=W0401,W0611 """check unexistant names imported are reported""" __revision__ = None diff --git a/test/input/func_newstyle___slots__.py b/test/input/func_newstyle___slots__.py index 78909c0..820c8ec 100644 --- a/test/input/func_newstyle___slots__.py +++ b/test/input/func_newstyle___slots__.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """test __slots__ on old style class""" __revision__ = 1 diff --git a/test/input/func_newstyle_exceptions.py b/test/input/func_newstyle_exceptions.py index 055d70b..a9a2fab 100644 --- a/test/input/func_newstyle_exceptions.py +++ b/test/input/func_newstyle_exceptions.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 """test pb with exceptions and old/new style classes""" __revision__ = 1 diff --git a/test/input/func_newstyle_property.py b/test/input/func_newstyle_property.py index cdce8fa..a2d208c 100644 --- a/test/input/func_newstyle_property.py +++ b/test/input/func_newstyle_property.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """test property on old style class""" __revision__ = 1 diff --git a/test/input/func_newstyle_super.py b/test/input/func_newstyle_super.py index e84c908..c526cbe 100644 --- a/test/input/func_newstyle_super.py +++ b/test/input/func_newstyle_super.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """check use of super""" __revision__ = None diff --git a/test/input/func_noerror___init___return_from_inner_function.py b/test/input/func_noerror___init___return_from_inner_function.py index 30b2671..10b6c00 100644 --- a/test/input/func_noerror___init___return_from_inner_function.py +++ b/test/input/func_noerror___init___return_from_inner_function.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """#10075""" __revision__ = 1 diff --git a/test/input/func_noerror_access_attr_before_def_false_positive.py b/test/input/func_noerror_access_attr_before_def_false_positive.py index ff55d9e..5f37f82 100644 --- a/test/input/func_noerror_access_attr_before_def_false_positive.py +++ b/test/input/func_noerror_access_attr_before_def_false_positive.py @@ -1,4 +1,4 @@ -#pylint: disable-msg=C0103,R0904,R0903,W0201 +#pylint: disable=C0103,R0904,R0903,W0201 """ This module demonstrates a possible problem of pyLint with calling __init__ s from inherited classes. diff --git a/test/input/func_noerror_base_init_vars.py b/test/input/func_noerror_base_init_vars.py index cc9882f..24ad879 100644 --- a/test/input/func_noerror_base_init_vars.py +++ b/test/input/func_noerror_base_init_vars.py @@ -1,4 +1,4 @@ -# pylint:disable-msg=R0201 +# pylint:disable=R0201 """Checks that class variables are seen as inherited ! """ __revision__ = '' diff --git a/test/input/func_noerror_classes_meth_could_be_a_function.py b/test/input/func_noerror_classes_meth_could_be_a_function.py index d97b6cb..c1b160f 100644 --- a/test/input/func_noerror_classes_meth_could_be_a_function.py +++ b/test/input/func_noerror_classes_meth_could_be_a_function.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=C0111,R0903,W0232 +# pylint: disable=C0111,R0903,W0232 """ #2479 @@ -18,7 +18,7 @@ class Aimpl: # disable "method could be a function" on classes which are not overriding # the factory method because in that case the usage of polymorphism is not # detected - # pylint: disable-msg=R0201 + # pylint: disable=R0201 def makex(self): return XAsub() diff --git a/test/input/func_noerror_classes_meth_signature.py b/test/input/func_noerror_classes_meth_signature.py index dea3e6c..e6c95f4 100644 --- a/test/input/func_noerror_classes_meth_signature.py +++ b/test/input/func_noerror_classes_meth_signature.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=C0111,R0922,R0903 +# pylint: disable=C0111,R0922,R0903 """#2485 W0222 "Signature differs from overriden method" false positive """ diff --git a/test/input/func_noerror_decorator_scope.py b/test/input/func_noerror_decorator_scope.py index ef8cfaf..2f35d97 100644 --- a/test/input/func_noerror_decorator_scope.py +++ b/test/input/func_noerror_decorator_scope.py @@ -1,4 +1,4 @@ -# -*- pylint: disable-msg=W0232,R0903 +# -*- pylint: disable=W0232,R0903 """Test that decorators sees the class namespace - just like function default values does but function body doesn't. diff --git a/test/input/func_noerror_defined_and_used_on_same_line.py b/test/input/func_noerror_defined_and_used_on_same_line.py index 17e4557..133c9f4 100644 --- a/test/input/func_noerror_defined_and_used_on_same_line.py +++ b/test/input/func_noerror_defined_and_used_on_same_line.py @@ -1,4 +1,4 @@ -#pylint: disable-msg=C0111,C0321 +#pylint: disable=C0111,C0321 """pylint complains about 'index' being used before definition""" __revision__ = None diff --git a/test/input/func_noerror_defined_and_used_on_same_line_py24.py b/test/input/func_noerror_defined_and_used_on_same_line_py24.py index 8032a8f..9977e03 100644 --- a/test/input/func_noerror_defined_and_used_on_same_line_py24.py +++ b/test/input/func_noerror_defined_and_used_on_same_line_py24.py @@ -1,4 +1,4 @@ -#pylint: disable-msg=C0111,C0321 +#pylint: disable=C0111,C0321 """pylint complains about 'index' being used before definition""" __revision__ = None diff --git a/test/input/func_noerror_defined_and_used_on_same_line_py25.py b/test/input/func_noerror_defined_and_used_on_same_line_py25.py index 71f6a1b..adf9386 100644 --- a/test/input/func_noerror_defined_and_used_on_same_line_py25.py +++ b/test/input/func_noerror_defined_and_used_on_same_line_py25.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=C0321 +# pylint: disable=C0321 """test http://www.logilab.org/ticket/6954""" from __future__ import with_statement diff --git a/test/input/func_noerror_e1101_9588_base_attr_aug_assign.py b/test/input/func_noerror_e1101_9588_base_attr_aug_assign.py index 4204146..03106a5 100644 --- a/test/input/func_noerror_e1101_9588_base_attr_aug_assign.py +++ b/test/input/func_noerror_e1101_9588_base_attr_aug_assign.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """ False positive case of E1101: diff --git a/test/input/func_noerror_except_pass.py b/test/input/func_noerror_except_pass.py index d032f2a..a28c4ea 100644 --- a/test/input/func_noerror_except_pass.py +++ b/test/input/func_noerror_except_pass.py @@ -7,5 +7,5 @@ __revision__ = None try: A = 2 except ValueError: - pass # pylint: disable-msg=W0107 + pass # pylint: disable=W0107 print A diff --git a/test/input/func_noerror_external_classmethod_crash.py b/test/input/func_noerror_external_classmethod_crash.py index 7674388..7bd5792 100644 --- a/test/input/func_noerror_external_classmethod_crash.py +++ b/test/input/func_noerror_external_classmethod_crash.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=W0232,R0903,W0613 +# pylint: disable=W0232,R0903,W0613 """tagging a function as a class method cause a crash when checking for signature overriding """ diff --git a/test/input/func_noerror_factory_method.py b/test/input/func_noerror_factory_method.py index 026ec0f..bd24479 100644 --- a/test/input/func_noerror_factory_method.py +++ b/test/input/func_noerror_factory_method.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """use new astng context sensitive inference""" __revision__ = 1 diff --git a/test/input/func_noerror_function_as_method.py b/test/input/func_noerror_function_as_method.py index 8deaf79..6d96a65 100644 --- a/test/input/func_noerror_function_as_method.py +++ b/test/input/func_noerror_function_as_method.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 '''Test that a function is considered a method when looked up through a class. ''' __revision__ = 1 diff --git a/test/input/func_noerror_genexp_in_class_scope.py b/test/input/func_noerror_genexp_in_class_scope.py index 6447c2e..508f540 100644 --- a/test/input/func_noerror_genexp_in_class_scope.py +++ b/test/input/func_noerror_genexp_in_class_scope.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=W0232,R0903 +# pylint: disable=W0232,R0903 """class scope must be handled correctly in genexps""" __revision__ = '' diff --git a/test/input/func_noerror_inner_classes.py b/test/input/func_noerror_inner_classes.py index 7d70d19..02391a2 100644 --- a/test/input/func_noerror_inner_classes.py +++ b/test/input/func_noerror_inner_classes.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """Backend Base Classes for the schwelm user DB""" __revision__ = "alpha" diff --git a/test/input/func_noerror_mcs_attr_access.py b/test/input/func_noerror_mcs_attr_access.py index c42c061..0ef3971 100644 --- a/test/input/func_noerror_mcs_attr_access.py +++ b/test/input/func_noerror_mcs_attr_access.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """test attribute access on metaclass""" diff --git a/test/input/func_noerror_nested_classes.py b/test/input/func_noerror_nested_classes.py index 96cd366..838e66c 100644 --- a/test/input/func_noerror_nested_classes.py +++ b/test/input/func_noerror_nested_classes.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """crash test""" __revision__ = 1 diff --git a/test/input/func_noerror_nonregr.py b/test/input/func_noerror_nonregr.py index d0440b1..7e3a5cc 100644 --- a/test/input/func_noerror_nonregr.py +++ b/test/input/func_noerror_nonregr.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=W0104 +# pylint: disable=W0104 """snippets of codes which have at some point made pylint crash""" __revision__ = 1 diff --git a/test/input/func_noerror_object_as_class_attribute.py b/test/input/func_noerror_object_as_class_attribute.py index 6b442ea..39eae0e 100644 --- a/test/input/func_noerror_object_as_class_attribute.py +++ b/test/input/func_noerror_object_as_class_attribute.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """Test case for the problem described below : - A class extends 'object' - This class defines its own __init__() diff --git a/test/input/func_noerror_overloaded_operator.py b/test/input/func_noerror_overloaded_operator.py index eb79141..3edd122 100644 --- a/test/input/func_noerror_overloaded_operator.py +++ b/test/input/func_noerror_overloaded_operator.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=C0111,R0903 +# pylint: disable=C0111,R0903 """#3291""" __revision__ = 1 diff --git a/test/input/func_noerror_raise_return_self.py b/test/input/func_noerror_raise_return_self.py index 93a07b2..2834c3c 100644 --- a/test/input/func_noerror_raise_return_self.py +++ b/test/input/func_noerror_raise_return_self.py @@ -1,5 +1,5 @@ """see ticket #5672""" -# pylint: disable-msg=R0903,W0232,C0111,C0103 +# pylint: disable=R0903,W0232,C0111,C0103 __revision__ = 0 diff --git a/test/input/func_noerror_staticmethod_as_decorator_py24.py b/test/input/func_noerror_staticmethod_as_decorator_py24.py index e5a44f2..efad8c9 100644 --- a/test/input/func_noerror_staticmethod_as_decorator_py24.py +++ b/test/input/func_noerror_staticmethod_as_decorator_py24.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """test staticmethod and classmethod as decorator""" __revision__ = None diff --git a/test/input/func_noerror_w0232.py b/test/input/func_noerror_w0232.py index f4c4232..df93855 100644 --- a/test/input/func_noerror_w0232.py +++ b/test/input/func_noerror_w0232.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903,R0923 +# pylint: disable=R0903,R0923 """check interface and exception without __init__ doesn't print warnings """ __revision__ = '' diff --git a/test/input/func_operators.py b/test/input/func_operators.py index 73d98c7..48606bf 100644 --- a/test/input/func_operators.py +++ b/test/input/func_operators.py @@ -1,6 +1,6 @@ """check operator use""" -#pylint: disable-msg=C0103 -#pylint: disable-msg=W0104 +#pylint: disable=C0103 +#pylint: disable=W0104 __revision__ = 42 diff --git a/test/input/func_r0901.py b/test/input/func_r0901.py index d30d270..79e98d1 100644 --- a/test/input/func_r0901.py +++ b/test/input/func_r0901.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=W0232, R0903 +# pylint: disable=W0232, R0903 """test max parents""" __revision__ = None diff --git a/test/input/func_r0902.py b/test/input/func_r0902.py index 59d4100..db39cfa 100644 --- a/test/input/func_r0902.py +++ b/test/input/func_r0902.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """test max instance attributes""" __revision__ = None diff --git a/test/input/func_r0904.py b/test/input/func_r0904.py index abb4d06..a4c694f 100644 --- a/test/input/func_r0904.py +++ b/test/input/func_r0904.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0201 +# pylint: disable=R0201 """test max methods""" __revision__ = None class Aaaa: diff --git a/test/input/func_scope_regrtest.py b/test/input/func_scope_regrtest.py index 98dd8be..367a908 100644 --- a/test/input/func_scope_regrtest.py +++ b/test/input/func_scope_regrtest.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903,W0232 +# pylint: disable=R0903,W0232 """check for scope problems""" __revision__ = None diff --git a/test/input/func_typecheck_callfunc_assigment.py b/test/input/func_typecheck_callfunc_assigment.py index c21f0ad..ee7bbee 100644 --- a/test/input/func_typecheck_callfunc_assigment.py +++ b/test/input/func_typecheck_callfunc_assigment.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0921 +# pylint: disable=R0921 """check assignment to function call where the function doesn't return 'E1111': ('Assigning to function call which doesn\'t return', diff --git a/test/input/func_typecheck_getattr.py b/test/input/func_typecheck_getattr.py index a9e7b5e..e5c4e4c 100644 --- a/test/input/func_typecheck_getattr.py +++ b/test/input/func_typecheck_getattr.py @@ -1,4 +1,4 @@ -# pylint: disable-msg= +# pylint: disable= """check getattr if inference succeed""" __revision__ = None diff --git a/test/input/func_typecheck_non_callable_call.py b/test/input/func_typecheck_non_callable_call.py index 75b1224..73c5db2 100644 --- a/test/input/func_typecheck_non_callable_call.py +++ b/test/input/func_typecheck_non_callable_call.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """ 'E1102': ('%s is not callable', 'Used when an object being called has been infered to a non \ diff --git a/test/input/func_undefined_var.py b/test/input/func_undefined_var.py index 45b933b..5d46f01 100644 --- a/test/input/func_undefined_var.py +++ b/test/input/func_undefined_var.py @@ -41,12 +41,12 @@ except NameError: try: POUETT # don't catch me -except Exception: # pylint:disable-msg = W0703 +except Exception: # pylint:disable = W0703 POUETT = 'something' try: POUETTT # don't catch me -except: # pylint:disable-msg = W0702 +except: # pylint:disable = W0702 POUETTT = 'something' print POUET, POUETT, POUETTT diff --git a/test/input/func_unused_overridden_argument.py b/test/input/func_unused_overridden_argument.py index 99bd25c..d0794ae 100644 --- a/test/input/func_unused_overridden_argument.py +++ b/test/input/func_unused_overridden_argument.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """for Sub.inherited, only the warning for "aay" is desired. The warnings for "aab" and "aac" are most likely false positives though, because there could be another subclass that overrides the same method and does diff --git a/test/input/func_w0102.py b/test/input/func_w0102.py index e954d0e..f415fe3 100644 --- a/test/input/func_w0102.py +++ b/test/input/func_w0102.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0201 +# pylint: disable=R0201 """docstring""" __revision__ = '' diff --git a/test/input/func_w0108.py b/test/input/func_w0108.py index 2f7ca4a..0da9a96 100644 --- a/test/input/func_w0108.py +++ b/test/input/func_w0108.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=W0142 +# pylint: disable=W0142 """test suspicious lambda expressions """ diff --git a/test/input/func_w0133.py b/test/input/func_w0133.py index c0304ec..7d333b6 100644 --- a/test/input/func_w0133.py +++ b/test/input/func_w0133.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903,R0201 +# pylint: disable=R0903,R0201 """test Invalid name""" __revision__ = 1 diff --git a/test/input/func_w0223.py b/test/input/func_w0223.py index 0682172..9980bd3 100644 --- a/test/input/func_w0223.py +++ b/test/input/func_w0223.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903,R0922 +# pylint: disable=R0903,R0922 """test overriding of abstract method """ diff --git a/test/input/func_w0231.py b/test/input/func_w0231.py index 3f592ec..ddebae1 100644 --- a/test/input/func_w0231.py +++ b/test/input/func_w0231.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """test for __init__ not called """ diff --git a/test/input/func_w0233.py b/test/input/func_w0233.py index 3400438..0d90ede 100644 --- a/test/input/func_w0233.py +++ b/test/input/func_w0233.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903,W0212,W0403,W0406 +# pylint: disable=R0903,W0212,W0403,W0406 """test for call to __init__ from a non ancestor class """ diff --git a/test/input/func_w0613.py b/test/input/func_w0613.py index 0573714..5b8e6ee 100644 --- a/test/input/func_w0613.py +++ b/test/input/func_w0613.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903 +# pylint: disable=R0903 """test unused argument """ @@ -29,9 +29,9 @@ class AAAA: description=[(etype,)]*size) def inner(row, col=0, etype=etype, req=self, rset=rset): """inner using all its argument""" - # pylint: disable-msg = E1103 + # pylint: disable = E1103 return req.vreg.etype_class(etype)(req, rset, row, col) - # pylint: disable-msg = W0201 + # pylint: disable = W0201 rset.get_entity = inner class BBBB: diff --git a/test/input/func_w0622.py b/test/input/func_w0622.py index ea9d1b2..3d0933b 100644 --- a/test/input/func_w0622.py +++ b/test/input/func_w0622.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 """test built-in redefinition """ __revision__ = 0 diff --git a/test/input/func_w6501.py b/test/input/func_w6501.py index 37c05d3..9013c2d 100644 --- a/test/input/func_w6501.py +++ b/test/input/func_w6501.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=E1101 +# pylint: disable=E1101 """test checking use of the logging module """ diff --git a/test/regrtest_data/import_package_subpackage_module.py b/test/regrtest_data/import_package_subpackage_module.py index b5fb219..a1d4747 100644 --- a/test/regrtest_data/import_package_subpackage_module.py +++ b/test/regrtest_data/import_package_subpackage_module.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=I0011,C0301,W0611 +# pylint: disable=I0011,C0301,W0611 """I found some of my scripts trigger off an AttributeError in pylint 0.8.1 (with common 0.12.0 and astng 0.13.1). diff --git a/test/regrtest_data/module_global.py b/test/regrtest_data/module_global.py index 54fd46d..074b9cf 100644 --- a/test/regrtest_data/module_global.py +++ b/test/regrtest_data/module_global.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=W0603,W0601,W0604,E0602,W0104 +# pylint: disable=W0603,W0601,W0604,E0602,W0104 """was causing infinite recursion """ __revision__ = 1 diff --git a/test/regrtest_data/package/__init__.py b/test/regrtest_data/package/__init__.py index 9e1ebfa..8d82b43 100644 --- a/test/regrtest_data/package/__init__.py +++ b/test/regrtest_data/package/__init__.py @@ -1,4 +1,4 @@ -# pylint: disable-msg=R0903,W0403 +# pylint: disable=R0903,W0403 """package's __init__ file""" __revision__ = 0 diff --git a/test/regrtest_data/pygtk_import.py b/test/regrtest_data/pygtk_import.py index 4ac9560..974035e 100644 --- a/test/regrtest_data/pygtk_import.py +++ b/test/regrtest_data/pygtk_import.py @@ -1,4 +1,4 @@ -#pylint: disable-msg=R0903,R0904 +#pylint: disable=R0903,R0904 """#10026""" __revision__ = 1 from gtk import VBox diff --git a/test/regrtest_data/try_finally_disable_msg_crash.py b/test/regrtest_data/try_finally_disable_msg_crash.py index 9628191..1719308 100644 --- a/test/regrtest_data/try_finally_disable_msg_crash.py +++ b/test/regrtest_data/try_finally_disable_msg_crash.py @@ -1,5 +1,5 @@ try: pass finally: - # pylint: disable-msg=W0201 + # pylint: disable=W0201 pass diff --git a/test/test_func.py b/test/test_func.py index ab8ab84..74cd3d4 100644 --- a/test/test_func.py +++ b/test/test_func.py @@ -86,9 +86,9 @@ class LintTestUsingModule(testlib.TestCase): def _test(self, tocheck): if INFO_TEST_RGX.match(self.module): - self.linter.enable_message_category('I') + self.linter.enable('I') else: - self.linter.disable_message_category('I') + self.linter.disable('I') try: self.linter.check(tocheck) except Exception, ex: diff --git a/test/test_import_graph.py b/test/test_import_graph.py index 7e08a56..3347515 100644 --- a/test/test_import_graph.py +++ b/test/test_import_graph.py @@ -42,7 +42,7 @@ class ImportCheckerTC(unittest.TestCase): def test_checker_dep_graphs(self): l = self.linter l.global_set_option('persistent', False) - l.global_set_option('enable-checker', 'imports') + l.global_set_option('enable', 'imports') l.global_set_option('import-graph', 'import.dot') l.global_set_option('ext-import-graph', 'ext_import.dot') l.global_set_option('int-import-graph', 'int_import.dot') @@ -60,6 +60,6 @@ class ImportCheckerTC(unittest.TestCase): os.remove(fname) except: pass - + if __name__ == '__main__': unittest.main() diff --git a/test/test_regr.py b/test/test_regr.py index 8f2f0c2..dec9908 100644 --- a/test/test_regr.py +++ b/test/test_regr.py @@ -31,7 +31,7 @@ from pylint import checkers test_reporter = TestReporter() linter = PyLinter() linter.set_reporter(test_reporter) -linter.disable_message_category('I') +linter.disable('I') linter.config.persistent = 0 checkers.initialize(linter) @@ -153,16 +153,20 @@ class MessagesHandlerMixIn: return ':%s: *%s*\n%s' % (msg.msgid, title, desc) return ':%s:\n%s' % (msg.msgid, desc) - def disable_message(self, msgid, scope='package', line=None): + def disable(self, msgid, scope='package', line=None): """don't output message of the given id""" assert scope in ('package', 'module') + # msgid is a category? catid = category_id(msgid) if catid is not None: - self._activate_msgs_cat(catid, scope, line, False, 'I0011') + for msgid in self._msgs_by_category.get(catid): + self.disable(msgid, scope, line) return # msgid is a checker name? if msgid.lower() in self._checkers: - self._activate_checker_msgs(msgid.lower(), True) + for checker in self._checkers[msgid.lower()]: + for msgid in checker.msgs: + self.disable(msgid, scope, line) return msg = self.check_message_id(msgid) if scope == 'module': @@ -181,13 +185,14 @@ class MessagesHandlerMixIn: self.config.disable_msg = [mid for mid, val in msgs.items() if not val] - def enable_message(self, msgid, scope='package', line=None): + def enable(self, msgid, scope='package', line=None): """reenable message of the given id""" assert scope in ('package', 'module') catid = category_id(msgid) # msgid is a category? if catid is not None: - self._activate_msgs_cat(catid, scope, line, True, 'I0012') + for msgid in self._msgs_by_category.get(catid): + self.enable(msgid, scope, line) return # msgid is a checker name? if msgid.lower() in self._checkers: @@ -206,22 +211,7 @@ class MessagesHandlerMixIn: msgs = self._msgs_state msgs[msg.msgid] = True # sync configuration object - self.config.enable_msg = [mid for mid, val in msgs.items() if val] - - def _activate_checker_msgs(self, checkername, value): - for checker in self._checkers[checkername]: - for msgid in checker.msgs: - msgsdict[msgid] = value - - def _activate_msgs_cat(self, catid, scope, line, value, warnmsgid): - assert scope in ('package', 'module') - if scope == 'module': - self.add_message(warnmsgid, line=line, args=catid) - msgsdict = self._module_msgs_state - else: - msgsdict = self._msgs_state - for msgid in self._msgs_by_category.get(catid): - msgsdict[msgid] = value + self.config.enable = [mid for mid, val in msgs.items() if val] def check_message_id(self, msgid): """raise UnknownMessage if the message id is not defined""" |