diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-01-12 11:14:16 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-01-12 11:14:16 +0200 |
commit | 8ce01f5f8a76b3f44db48ba54a9ec4c690b184b8 (patch) | |
tree | d25ac2ea83d3aaef3050d5914c8de12390734269 | |
parent | 7b1af63f6e3a2cdd84d4b9d2aaa8fd336d6dc03f (diff) | |
parent | 995e61bf79b55b69fc9303b4b93d59ec3cd31a9c (diff) | |
download | pylint-8ce01f5f8a76b3f44db48ba54a9ec4c690b184b8.tar.gz |
Merged in ydirson/pylint (pull request #212)
Dispatch the GUI widgets in 3 resizable panes. Closes issue #423.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | checkers/classes.py | 12 | ||||
-rw-r--r-- | setup.py | 28 | ||||
-rw-r--r-- | test/messages/func_interfaces.txt | 2 | ||||
-rw-r--r-- | test/messages/func_w0205.txt | 2 |
5 files changed, 38 insertions, 10 deletions
@@ -34,6 +34,10 @@ ChangeLog for Pylint * Add a new JSON reporter, usable through -f flag. + * Add the method names for the 'signature-differs' and 'argument-differs' + warnings. Closes issue #433. + + * Don't compile test files when installing. 2014-11-23 -- 1.4.0 diff --git a/checkers/classes.py b/checkers/classes.py index 7b216fe..1a10c35 100644 --- a/checkers/classes.py +++ b/checkers/classes.py @@ -179,11 +179,11 @@ MSGS = { 'missing-interface-method', 'Used when a method declared in an interface is missing from a \ class implementing this interface'), - 'W0221': ('Arguments number differs from %s method', + 'W0221': ('Arguments number differs from %s %r method', 'arguments-differ', 'Used when a method has a different number of arguments than in \ the implemented interface or in an overridden method.'), - 'W0222': ('Signature differs from %s method', + 'W0222': ('Signature differs from %s %r method', 'signature-differs', 'Used when a method signature is different than in the \ implemented interface or in an overridden method.'), @@ -939,9 +939,13 @@ a metaclass class method.'} if is_attr_private(method1.name): return if len(method1.args.args) != len(refmethod.args.args): - self.add_message('arguments-differ', args=class_type, node=method1) + self.add_message('arguments-differ', + args=(class_type, method1.name), + node=method1) elif len(method1.args.defaults) < len(refmethod.args.defaults): - self.add_message('signature-differs', args=class_type, node=method1) + self.add_message('signature-differs', + args=(class_type, method1.name), + node=method1) def is_first_attr(self, node): """Check that attribute lookup name use first attribute variable name @@ -32,12 +32,14 @@ try: if os.environ.get('NO_SETUPTOOLS'): raise ImportError() from setuptools import setup + from setuptools.command import easy_install as easy_install_lib from setuptools.command import install_lib USE_SETUPTOOLS = 1 except ImportError: from distutils.core import setup from distutils.command import install_lib USE_SETUPTOOLS = 0 + easy_install_lib = None from distutils.command.build_py import build_py @@ -97,6 +99,11 @@ except ImportError: pass ''' +def _filter_tests(files): + testdir = join('pylint', 'test') + return [f for f in files if testdir not in f] + + class MyInstallLib(install_lib.install_lib): """extend install_lib command to handle package __init__.py and include_dirs variable if necessary @@ -138,10 +145,20 @@ class MyInstallLib(install_lib.install_lib): # files, some of them being syntactically wrong by design, and this scares # the end-user def byte_compile(self, files): - testdir = join('pylint', 'test') - files = [f for f in files if testdir not in f] + files = _filter_tests(files) install_lib.install_lib.byte_compile(self, files) + +if easy_install_lib: + class easy_install(easy_install_lib.easy_install): + # override this since pip/easy_install attempt to byte compile + # test data files, some of them being syntactically wrong by design, + # and this scares the end-user + def byte_compile(self, files): + files = _filter_tests(files) + easy_install_lib.easy_install.byte_compile(self, files) + + def install(**kwargs): """setup entry point""" if USE_SETUPTOOLS: @@ -171,6 +188,10 @@ def install(**kwargs): 'symilar = pylint:run_symilar', ]} kwargs['packages'] = packages + cmdclass = {'install_lib': MyInstallLib, + 'build_py': build_py} + if easy_install: + cmdclass['easy_install'] = easy_install return setup(name=distname, version=version, license=license, @@ -183,8 +204,7 @@ def install(**kwargs): classifiers=classifiers, data_files=data_files, ext_modules=ext_modules, - cmdclass={'install_lib': MyInstallLib, - 'build_py': build_py}, + cmdclass=cmdclass, **kwargs) if __name__ == '__main__': diff --git a/test/messages/func_interfaces.txt b/test/messages/func_interfaces.txt index 3b444d7..a4cd21d 100644 --- a/test/messages/func_interfaces.txt +++ b/test/messages/func_interfaces.txt @@ -3,4 +3,4 @@ E: 77:InterfaceCantBeFound: Undefined variable 'undefined' E: 88:InterfaceCanNowBeFound: Missing method 'troc' from IMachin interface E: 88:InterfaceCanNowBeFound: Missing method 'truc' from IMachin interface F: 77:InterfaceCantBeFound: failed to resolve interfaces implemented by InterfaceCantBeFound (undefined) -W: 71:BadArgument.troc: Arguments number differs from IMachin interface method +W: 71:BadArgument.troc: Arguments number differs from IMachin interface 'troc' method diff --git a/test/messages/func_w0205.txt b/test/messages/func_w0205.txt index 4b36dab..83ac5de 100644 --- a/test/messages/func_w0205.txt +++ b/test/messages/func_w0205.txt @@ -1,2 +1,2 @@ -W: 22:Cdef.abcd: Signature differs from overridden method +W: 22:Cdef.abcd: Signature differs from overridden 'abcd' method |