Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock
Please unblock package pylint This is a bugfix release (althought upstream has done some reorganization of the test files, but that doesn't impact the program usage) for which astroid was already unblocked. unblock pylint/1.3.1-1 -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.14-2-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
diff -Nru pylint-1.3.0/ChangeLog pylint-1.3.1/ChangeLog --- pylint-1.3.0/ChangeLog 2014-07-26 07:47:06.000000000 +0100 +++ pylint-1.3.1/ChangeLog 2014-08-24 22:06:20.000000000 +0100 @@ -1,6 +1,38 @@ ChangeLog for Pylint ==================== +2014-08-24 -- 1.3.1 + + * Fix a false positive with string formatting checker, when + encountering a string which uses only position-based arguments. + Closes issue #285. + + * Fix a false positive with string formatting checker, when using + keyword argument packing. Closes issue #288. + + * Handle 'too-few-format-args' or 'too-many-format-args' for format + strings with both named and positional fields. Closes issue #286. + + * Analyze only strings by the string format checker. Closes issue #287. + + * Properly handle nested format string fields. Closes issue #294. + + * Properly handle unicode format strings for Python 2. + Closes issue #296. + + * Fix a false positive with 'too-few-format-args', when the format + strings contains duplicate manual position arguments. + Closes issue #310. + + * fixme regex handles comments without spaces after the hash. + Closes issue #311. + + * Fix a crash encountered when looking for attribute docstrings. + + * Fix a crash which ocurred while checking for 'method-hidden', + when the parent frame was something different than a function. + + 2014-07-26 -- 1.3.0 * Allow hanging continued indentation for implicitly concatenated diff -Nru pylint-1.3.0/checkers/base.py pylint-1.3.1/checkers/base.py --- pylint-1.3.0/checkers/base.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/checkers/base.py 2014-08-24 21:58:08.000000000 +0100 @@ -555,7 +555,7 @@ pass else: sibling = expr.previous_sibling() - if (sibling.scope() is scope and + if (sibling is not None and sibling.scope() is scope and isinstance(sibling, astroid.Assign)): return self.add_message('pointless-string-statement', node=node) diff -Nru pylint-1.3.0/checkers/classes.py pylint-1.3.1/checkers/classes.py --- pylint-1.3.0/checkers/classes.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/checkers/classes.py 2014-08-24 21:59:46.000000000 +0100 @@ -344,9 +344,11 @@ try: overridden = klass.instance_attr(node.name)[0] # XXX overridden_frame = overridden.frame() - if overridden_frame.type == 'method': + if (isinstance(overridden_frame, astroid.Function) + and overridden_frame.type == 'method'): overridden_frame = overridden_frame.parent.frame() - if isinstance(overridden_frame, Class) and klass._is_subtype_of(overridden_frame.qname()): + if (isinstance(overridden_frame, Class) + and klass._is_subtype_of(overridden_frame.qname())): args = (overridden.root().name, overridden.fromlineno) self.add_message('method-hidden', args=args, node=node) except astroid.NotFoundError: diff -Nru pylint-1.3.0/checkers/misc.py pylint-1.3.1/checkers/misc.py --- pylint-1.3.0/checkers/misc.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/checkers/misc.py 2014-08-24 22:00:54.000000000 +0100 @@ -54,6 +54,17 @@ 'separated by a comma.')}),) def _check_note(self, notes, lineno, line): + # First, simply check if the notes are in the line at all. This is an + # optimisation to prevent using the regular expression on every line, + # but rather only on lines which may actually contain one of the notes. + # This prevents a pathological problem with lines that are hundreds + # of thousands of characters long. + for note in self.config.notes: + if note in line: + break + else: + return + match = notes.search(line) if not match: return @@ -74,7 +85,7 @@ stream.seek(0) # XXX may be removed with astroid > 0.23 if self.config.notes: notes = re.compile( - r'.*?#\s+(%s)(:*\s*.+)' % "|".join(self.config.notes)) + r'.*?#\s*(%s)(:*\s*.+)' % "|".join(self.config.notes)) else: notes = None if module.file_encoding: diff -Nru pylint-1.3.0/checkers/strings.py pylint-1.3.1/checkers/strings.py --- pylint-1.3.0/checkers/strings.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/checkers/strings.py 2014-08-24 21:58:08.000000000 +0100 @@ -21,6 +21,10 @@ import sys import tokenize import string +try: + import numbers +except ImportError: + numbers = None import astroid @@ -122,7 +126,7 @@ else: def _field_iterator_convertor(iterator): for is_attr, key in iterator: - if not isinstance(key, str): + if isinstance(key, numbers.Number): yield is_attr, int(key) else: yield is_attr, key @@ -133,15 +137,13 @@ # the output return keyname, _field_iterator_convertor(fielditerator) -def parse_format_method_string(format_string): - """ - Parses a PEP 3101 format string, returning a tuple of - (keys, num_args), - where keys is the set of mapping keys in the format string and num_args - is the number of arguments required by the format string. + +def collect_string_fields(format_string): + """ Given a format string, return an iterator + of all the valid format fields. It handles nested fields + as well. """ - keys = [] - num_args = 0 + formatter = string.Formatter() parseiterator = formatter.parse(format_string) try: @@ -150,20 +152,40 @@ # not a replacement format continue name = result[1] - if name: - keyname, fielditerator = split_format_field_names(name) - if not isinstance(keyname, str): - # In Python 2 it will return long which will lead - # to different output between 2 and 3 - keyname = int(keyname) - keys.append((keyname, list(fielditerator))) - else: - num_args += 1 + nested = result[2] + yield name + if nested: + for field in collect_string_fields(nested): + yield field except ValueError: # probably the format string is invalid # should we check the argument of the ValueError? raise utils.IncompleteFormatString(format_string) - return keys, num_args + +def parse_format_method_string(format_string): + """ + Parses a PEP 3101 format string, returning a tuple of + (keys, num_args, manual_pos_arg), + where keys is the set of mapping keys in the format string, num_args + is the number of arguments required by the format string and + manual_pos_arg is the number of arguments passed with the position. + """ + keys = [] + num_args = 0 + manual_pos_arg = set() + for name in collect_string_fields(format_string): + if name and str(name).isdigit(): + manual_pos_arg.add(str(name)) + elif name: + keyname, fielditerator = split_format_field_names(name) + if isinstance(keyname, numbers.Number): + # In Python 2 it will return long which will lead + # to different output between 2 and 3 + keyname = int(keyname) + keys.append((keyname, list(fielditerator))) + else: + num_args += 1 + return keys, num_args, len(manual_pos_arg) def get_args(callfunc): """ Get the arguments from the given `CallFunc` node. @@ -219,7 +241,8 @@ utils.parse_format_string(format_string) except utils.UnsupportedFormatCharacter, e: c = format_string[e.index] - self.add_message('bad-format-character', node=node, args=(c, ord(c), e.index)) + self.add_message('bad-format-character', + node=node, args=(c, ord(c), e.index)) return except utils.IncompleteFormatString: self.add_message('truncated-format-string', node=node) @@ -242,7 +265,8 @@ if isinstance(key, basestring): keys.add(key) else: - self.add_message('bad-format-string-key', node=node, args=key) + self.add_message('bad-format-string-key', + node=node, args=key) else: # One of the keys was something other than a # constant. Since we can't tell what it is, @@ -252,13 +276,16 @@ if not unknown_keys: for key in required_keys: if key not in keys: - self.add_message('missing-format-string-key', node=node, args=key) + self.add_message('missing-format-string-key', + node=node, args=key) for key in keys: if key not in required_keys: - self.add_message('unused-format-string-key', node=node, args=key) + self.add_message('unused-format-string-key', + node=node, args=key) elif isinstance(args, OTHER_NODES + (astroid.Tuple,)): type_name = type(args).__name__ - self.add_message('format-needs-mapping', node=node, args=type_name) + self.add_message('format-needs-mapping', + node=node, args=type_name) # else: # The RHS of the format specifier is a name or # expression. It may be a mapping object, so @@ -313,6 +340,13 @@ def _check_new_format(self, node, func): """ Check the new string formatting. """ + # TODO: skip (for now) format nodes which don't have + # an explicit string on the left side of the format operation. + # We do this because our inference engine can't properly handle + # redefinitions of the original string. + # For more details, see issue 287. + if not isinstance(node.func.expr, astroid.Const): + return try: strnode = func.bound.infer().next() except astroid.InferenceError: @@ -327,20 +361,24 @@ except astroid.InferenceError: return try: - fields, num_args = parse_format_method_string(strnode.value) + fields, num_args, manual_pos = parse_format_method_string(strnode.value) except utils.IncompleteFormatString: self.add_message('bad-format-string', node=node) return manual_fields = set(field[0] for field in fields - if isinstance(field[0], int)) + if isinstance(field[0], numbers.Number)) named_fields = set(field[0] for field in fields - if isinstance(field[0], str)) - if manual_fields and num_args: + if isinstance(field[0], basestring)) + if num_args and manual_pos: self.add_message('format-combined-specification', node=node) return + check_args = False + # Consider "{[0]} {[1]}" as num_args. + num_args += sum(1 for field in named_fields + if field == '') if named_fields: for field in named_fields: if field not in named and field: @@ -352,7 +390,23 @@ self.add_message('unused-format-string-argument', node=node, args=(field, )) + # num_args can be 0 if manual_pos is not. + num_args = num_args or manual_pos + if positional or num_args: + empty = any(True for field in named_fields + if field == '') + if named or empty: + # Verify the required number of positional arguments + # only if the .format got at least one keyword argument. + # This means that the format strings accepts both + # positional and named fields and we should warn + # when one of the them is missing or is extra. + check_args = True else: + check_args = True + if check_args: + # num_args can be 0 if manual_pos is not. + num_args = num_args or manual_pos if positional > num_args: # We can have two possibilities: # * "{0} {1}".format(a, b) @@ -363,9 +417,6 @@ elif positional < num_args: self.add_message('too-few-format-args', node=node) - if manual_fields and positional < len(manual_fields): - self.add_message('too-few-format-args', node=node) - self._check_new_format_specifiers(node, fields, named) def _check_new_format_specifiers(self, node, fields, named): @@ -381,26 +432,32 @@ # to 0. It will not be present in `named`, so use the value # 0 for it. key = 0 - if isinstance(key, int): + if isinstance(key, numbers.Number): try: - argument = utils.get_argument_from_call(node, key) + argname = utils.get_argument_from_call(node, key) except utils.NoSuchArgumentError: continue else: if key not in named: continue - argument = named[key] - if argument in (astroid.YES, None): + argname = named[key] + if argname in (astroid.YES, None): continue try: - argument = argument.infer().next() + argument = argname.infer().next() except astroid.InferenceError: continue if not specifiers or argument is astroid.YES: # No need to check this key if it doesn't # use attribute / item access continue - + if argument.parent and isinstance(argument.parent, astroid.Arguments): + # Check to see if our argument is kwarg or vararg, + # and skip the check for this argument if so, because when inferring, + # astroid will return empty objects (dicts and tuples) and + # that can lead to false positives. + if argname.name in (argument.parent.kwarg, argument.parent.vararg): + continue previous = argument parsed = [] for is_attribute, specifier in specifiers: diff -Nru pylint-1.3.0/checkers/variables.py pylint-1.3.1/checkers/variables.py --- pylint-1.3.0/checkers/variables.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/checkers/variables.py 2014-08-24 21:58:08.000000000 +0100 @@ -649,8 +649,15 @@ # comprehension and its direct outer scope is a class if scope_type == 'class' and i != start_index and not ( base_scope_type == 'comprehension' and i == start_index-1): - # XXX find a way to handle class scope in a smoother way - continue + # Detect if we are in a local class scope, as an assignment. + # For example, the following is fair game. + # class A: + # b = 1 + # c = lambda b=b: b * b + class_assignment = (isinstance(frame, astroid.Class) and + name in frame.locals) + if not class_assignment: + continue # the name has already been consumed, only check it's not a loop # variable used outside the loop if name in consumed: @@ -689,8 +696,14 @@ maybee0601 = not any(isinstance(child, astroid.Nonlocal) and name in child.names for child in defframe.get_children()) + if (self._to_consume[-1][-1] == 'lambda' and + isinstance(frame, astroid.Class) + and name in frame.locals): + maybee0601 = True + else: + maybee0601 = maybee0601 and stmt.fromlineno <= defstmt.fromlineno + if (maybee0601 - and stmt.fromlineno <= defstmt.fromlineno and not is_defined_before(node) and not are_exclusive(stmt, defstmt, ('NameError', 'Exception', @@ -699,8 +712,27 @@ astroid.AssName)): self.add_message('undefined-variable', args=name, node=node) elif self._to_consume[-1][-1] != 'lambda': - # E0601 may *not* occurs in lambda scope + # E0601 may *not* occurs in lambda scope. self.add_message('used-before-assignment', args=name, node=node) + elif self._to_consume[-1][-1] == 'lambda': + # E0601 can occur in class-level scope in lambdas, as in + # the following example: + # class A: + # x = lambda attr: f + attr + # f = 42 + if isinstance(frame, astroid.Class) and name in frame.locals: + if isinstance(node.parent, astroid.Arguments): + # Doing the following is fine: + # class A: + # x = 42 + # y = lambda attr=x: attr + if stmt.fromlineno <= defstmt.fromlineno: + self.add_message('used-before-assignment', + args=name, node=node) + else: + self.add_message('undefined-variable', + args=name, node=node) + if isinstance(node, astroid.AssName): # Aug AssName del consumed[name] else: diff -Nru pylint-1.3.0/debian/changelog pylint-1.3.1/debian/changelog --- pylint-1.3.0/debian/changelog 2014-11-07 00:02:08.000000000 +0000 +++ pylint-1.3.1/debian/changelog 2014-11-07 00:02:08.000000000 +0000 @@ -1,3 +1,15 @@ +pylint (1.3.1-1) unstable; urgency=medium + + * New upstream release + * debian/rules + - force execution of test suite + * debian/control + - bump version of astroid to minimum 1.2.1 + - bump Standards-Version to 3.9.6 (no changes needed) + - add dh-python to b-d + + -- Sandro Tosi <mo...@debian.org> Thu, 06 Nov 2014 23:53:16 +0000 + pylint (1.3.0-1) unstable; urgency=medium * New upstream release diff -Nru pylint-1.3.0/debian/control pylint-1.3.1/debian/control --- pylint-1.3.0/debian/control 2014-11-07 00:02:08.000000000 +0000 +++ pylint-1.3.1/debian/control 2014-11-07 00:02:08.000000000 +0000 @@ -3,9 +3,9 @@ Priority: optional Maintainer: Sandro Tosi <mo...@debian.org> Uploaders: Python Applications Packaging Team <python-apps-t...@lists.alioth.debian.org> -Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~) -Build-Depends-Indep: python-logilab-common (>= 0.53.0), python-astroid (>= 1.2.0), python-unittest2 -Standards-Version: 3.9.5 +Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), dh-python +Build-Depends-Indep: python-logilab-common (>= 0.53.0), python-astroid (>= 1.2.1), python-unittest2 +Standards-Version: 3.9.6 XS-Python-Version: >= 2.6 Homepage: http://www.pylint.org/ Vcs-Svn: svn://anonscm.debian.org/python-apps/packages/pylint/trunk/ @@ -13,7 +13,7 @@ Package: pylint Architecture: all -Depends: ${python:Depends}, ${misc:Depends}, python-logilab-common (>= 0.53.0), python-astroid (>= 1.2.0) +Depends: ${python:Depends}, ${misc:Depends}, python-logilab-common (>= 0.53.0), python-astroid (>= 1.2.1) Recommends: python-tk Description: Python code static checker and UML diagram generator Pylint is a Python source code analyzer which looks for programming diff -Nru pylint-1.3.0/debian/rules pylint-1.3.1/debian/rules --- pylint-1.3.0/debian/rules 2014-11-07 00:02:08.000000000 +0000 +++ pylint-1.3.1/debian/rules 2014-11-07 00:02:08.000000000 +0000 @@ -15,7 +15,7 @@ override_dh_auto_test: ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) # use the default python version to select the script dir to run the tests - -./test/fulltest.sh $(PYVERS) + -/bin/sh ./test/fulltest.sh $(PYVERS) endif diff -Nru pylint-1.3.0/DEPENDS pylint-1.3.1/DEPENDS --- pylint-1.3.0/DEPENDS 2014-07-26 07:45:30.000000000 +0100 +++ pylint-1.3.1/DEPENDS 2014-08-24 22:07:48.000000000 +0100 @@ -1,3 +1,3 @@ python-logilab-common (>= 0.19.0) -python-astroid (>= 1.2.0) +python-astroid (>= 1.2.1) python-tk diff -Nru pylint-1.3.0/MANIFEST.in pylint-1.3.1/MANIFEST.in --- pylint-1.3.0/MANIFEST.in 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/MANIFEST.in 2014-08-24 21:58:08.000000000 +0100 @@ -7,7 +7,7 @@ include elisp/startup elisp/*.el include man/*.1 recursive-include doc *.rst *.jpeg Makefile *.html *.py -recursive-include test *.py *.txt *.dot *.sh *.args +recursive-include test *.py *.txt *.dot *.sh *.rc include test/input/similar* include test/input/noext include test/data/ascript diff -Nru pylint-1.3.0/PKG-INFO pylint-1.3.1/PKG-INFO --- pylint-1.3.0/PKG-INFO 2014-07-26 08:29:40.000000000 +0100 +++ pylint-1.3.1/PKG-INFO 2014-08-24 22:20:42.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pylint -Version: 1.3.0 +Version: 1.3.1 Summary: python code static checker Home-page: http://www.pylint.org Author: Logilab diff -Nru pylint-1.3.0/__pkginfo__.py pylint-1.3.1/__pkginfo__.py --- pylint-1.3.0/__pkginfo__.py 2014-07-26 07:46:10.000000000 +0100 +++ pylint-1.3.1/__pkginfo__.py 2014-08-24 22:06:36.000000000 +0100 @@ -19,14 +19,14 @@ modname = distname = 'pylint' -numversion = (1, 3, 0) +numversion = (1, 3, 1) version = '.'.join([str(num) for num in numversion]) if sys.version_info < (2, 6): - install_requires = ['logilab-common >= 0.53.0', 'astroid >= 1.1', + install_requires = ['logilab-common >= 0.53.0', 'astroid >= 1.2.1', 'StringFormat'] else: - install_requires = ['logilab-common >= 0.53.0', 'astroid >= 1.1'] + install_requires = ['logilab-common >= 0.53.0', 'astroid >= 1.2.1'] license = 'GPL' description = "python code static checker" diff -Nru pylint-1.3.0/pylint.egg-info/entry_points.txt pylint-1.3.1/pylint.egg-info/entry_points.txt --- pylint-1.3.0/pylint.egg-info/entry_points.txt 2014-07-26 08:29:30.000000000 +0100 +++ pylint-1.3.1/pylint.egg-info/entry_points.txt 2014-08-24 22:20:24.000000000 +0100 @@ -1,7 +1,7 @@ [console_scripts] -pylint = pylint:run_pylint +pylint-gui = pylint:run_pylint_gui pyreverse = pylint:run_pyreverse epylint = pylint:run_epylint symilar = pylint:run_symilar -pylint-gui = pylint:run_pylint_gui +pylint = pylint:run_pylint diff -Nru pylint-1.3.0/pylint.egg-info/PKG-INFO pylint-1.3.1/pylint.egg-info/PKG-INFO --- pylint-1.3.0/pylint.egg-info/PKG-INFO 2014-07-26 08:29:30.000000000 +0100 +++ pylint-1.3.1/pylint.egg-info/PKG-INFO 2014-08-24 22:20:24.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pylint -Version: 1.3.0 +Version: 1.3.1 Summary: python code static checker Home-page: http://www.pylint.org Author: Logilab diff -Nru pylint-1.3.0/pylint.egg-info/requires.txt pylint-1.3.1/pylint.egg-info/requires.txt --- pylint-1.3.0/pylint.egg-info/requires.txt 2014-07-26 08:29:30.000000000 +0100 +++ pylint-1.3.1/pylint.egg-info/requires.txt 2014-08-24 22:20:24.000000000 +0100 @@ -1,2 +1,2 @@ logilab-common >= 0.53.0 -astroid >= 1.1 \ No newline at end of file +astroid >= 1.2.1 \ No newline at end of file diff -Nru pylint-1.3.0/pylint.egg-info/SOURCES.txt pylint-1.3.1/pylint.egg-info/SOURCES.txt --- pylint-1.3.0/pylint.egg-info/SOURCES.txt 2014-07-26 08:29:32.000000000 +0100 +++ pylint-1.3.1/pylint.egg-info/SOURCES.txt 2014-08-24 22:20:24.000000000 +0100 @@ -116,63 +116,92 @@ test/data/packages_No_Name.dot test/data/suppliermodule_test.py test/functional/__init__.py -test/functional/abstract_abc_methods.args test/functional/abstract_abc_methods.py -test/functional/anomalous_unicode_escape.args +test/functional/abstract_abc_methods.rc +test/functional/access_to__name__.py +test/functional/access_to__name__.txt +test/functional/access_to_protected_members.py +test/functional/access_to_protected_members.txt test/functional/anomalous_unicode_escape.py +test/functional/anomalous_unicode_escape.rc test/functional/anomalous_unicode_escape.txt +test/functional/arguments.py +test/functional/arguments.txt test/functional/bad_continuation.py test/functional/bad_continuation.txt -test/functional/bad_inline_option.args test/functional/bad_inline_option.py +test/functional/bad_inline_option.rc test/functional/bad_inline_option.txt test/functional/cellvar_escaping_loop.py test/functional/cellvar_escaping_loop.txt +test/functional/class_scope.py +test/functional/class_scope.txt test/functional/ctor_arguments.py test/functional/ctor_arguments.txt test/functional/docstrings.py test/functional/docstrings.txt +test/functional/duplicate_dict_literal_key.py +test/functional/duplicate_dict_literal_key.txt test/functional/exception_is_binary_op.py test/functional/exception_is_binary_op.txt test/functional/future_import.py -test/functional/future_unicode_literals.args test/functional/future_unicode_literals.py +test/functional/future_unicode_literals.rc test/functional/future_unicode_literals.txt +test/functional/globals.py +test/functional/globals.txt +test/functional/invalid__all__object.py +test/functional/invalid__all__object.txt +test/functional/invalid_exceptions_raised.py +test/functional/invalid_exceptions_raised.txt test/functional/method_hidden.py test/functional/method_hidden.txt -test/functional/name_styles.args test/functional/name_styles.py +test/functional/name_styles.rc test/functional/name_styles.txt -test/functional/namedtuple_member_inference.args test/functional/namedtuple_member_inference.py +test/functional/namedtuple_member_inference.rc test/functional/namedtuple_member_inference.txt +test/functional/names_in__all__.py +test/functional/names_in__all__.txt test/functional/newstyle__slots__.py test/functional/newstyle__slots__.txt +test/functional/newstyle_properties.py +test/functional/newstyle_properties.txt +test/functional/pygtk_enum_crash.py +test/functional/pygtk_enum_crash.rc +test/functional/pygtk_import.py +test/functional/pygtk_import.rc test/functional/redefined_builtin.py test/functional/redefined_builtin.txt -test/functional/suspicious_str_strip_call.args +test/functional/socketerror_import.py +test/functional/string_formatting.py +test/functional/string_formatting.txt +test/functional/string_formatting_py27.py +test/functional/string_formatting_py27.rc +test/functional/string_formatting_py27.txt +test/functional/super_checks.py +test/functional/super_checks.txt test/functional/suspicious_str_strip_call.py +test/functional/suspicious_str_strip_call.rc test/functional/suspicious_str_strip_call.txt -test/functional/suspicious_str_strip_call_py3.args test/functional/suspicious_str_strip_call_py3.py +test/functional/suspicious_str_strip_call_py3.rc test/functional/suspicious_str_strip_call_py3.txt test/functional/undefined_variable.py test/functional/undefined_variable.txt +test/functional/uninferable_all_object.py test/functional/unnecessary_lambda.py test/functional/unnecessary_lambda.txt -test/functional/unpacked_exceptions.args test/functional/unpacked_exceptions.py +test/functional/unpacked_exceptions.rc test/functional/unpacked_exceptions.txt test/functional/useless_else_on_loop.py test/functional/useless_else_on_loop.txt test/input/__init__.py test/input/func_3k_removed_stuff_py_30.py -test/input/func___name___access.py test/input/func_abstract_class_instantiated_py30.py test/input/func_abstract_class_instantiated_py34.py -test/input/func_all.py -test/input/func_all_undefined.py -test/input/func_arguments.py test/input/func_assert_2uple.py test/input/func_assigning_non_slot.py test/input/func_attrs_definition_order.py @@ -190,7 +219,6 @@ test/input/func_break_or_return_in_try_finally.py test/input/func_bug113231.py test/input/func_catching_non_exception.py -test/input/func_class_access_protected_members.py test/input/func_class_members.py test/input/func_continue_not_in_loop.py test/input/func_dangerous_default.py @@ -198,7 +226,6 @@ test/input/func_deprecated_lambda_py_30.py test/input/func_deprecated_module_py30.py test/input/func_deprecated_module_py_30.py -test/input/func_dict_keys.py test/input/func_disable_linebased.py test/input/func_dotted_ancestor.py test/input/func_e0001_py30.py @@ -215,7 +242,6 @@ test/input/func_e13xx.py test/input/func_empty_module.py test/input/func_eval_used.py -test/input/func_exceptions_raise_type_error.py test/input/func_excess_escapes.py test/input/func_exec_used_py30.py test/input/func_f0001.py @@ -225,7 +251,6 @@ test/input/func_format_py27.py test/input/func_format_py_27.py test/input/func_genexpr_var_scope_py24.py -test/input/func_globals.py test/input/func_i0011.py test/input/func_i0012.py test/input/func_i0013.py @@ -247,19 +272,14 @@ test/input/func_method_could_be_function.py test/input/func_method_missing_self.py test/input/func_method_without_self_but_self_assignment.py -test/input/func_missing_super_argument_py_30.py test/input/func_module___dict__.py test/input/func_more_e0604.py test/input/func_nameerror_on_string_substitution.py test/input/func_names_imported_from_module.py -test/input/func_newstyle_exceptions.py -test/input/func_newstyle_property.py -test/input/func_newstyle_super.py test/input/func_no_dummy_redefined.py test/input/func_no_final_new_line.py test/input/func_noerror___init___return_from_inner_function.py test/input/func_noerror_access_attr_before_def_false_positive.py -test/input/func_noerror_all_no_inference.py test/input/func_noerror_base_init_vars.py test/input/func_noerror_builtin_module_test.py test/input/func_noerror_class_attributes.py @@ -320,7 +340,6 @@ test/input/func_reqattrs.py test/input/func_return_outside_func.py test/input/func_return_yield_mix_py_33.py -test/input/func_scope_regrtest.py test/input/func_set_literal_as_default_py27.py test/input/func_string_format_py27.py test/input/func_superfluous_parens.py @@ -402,13 +421,8 @@ test/input/func_w0401_package/thing2.py test/messages/builtin_module.txt test/messages/func_3k_removed_stuff_py_30.txt -test/messages/func___name___access.txt -test/messages/func___name___access_py30.txt test/messages/func_abstract_class_instantiated_py30.txt test/messages/func_abstract_class_instantiated_py34.txt -test/messages/func_all.txt -test/messages/func_all_undefined.txt -test/messages/func_arguments.txt test/messages/func_assert_2uple.txt test/messages/func_assigning_non_slot.txt test/messages/func_attrs_definition_order.txt @@ -426,7 +440,6 @@ test/messages/func_break_or_return_in_try_finally.txt test/messages/func_bug113231.txt test/messages/func_catching_non_exception.txt -test/messages/func_class_access_protected_members.txt test/messages/func_class_members.txt test/messages/func_continue_not_in_loop.txt test/messages/func_dangerous_default.txt @@ -435,7 +448,6 @@ test/messages/func_deprecated_lambda_py_30.txt test/messages/func_deprecated_module_py30.txt test/messages/func_deprecated_module_py_30.txt -test/messages/func_dict_keys.txt test/messages/func_disable_linebased.txt test/messages/func_disable_linebased_py30.txt test/messages/func_dotted_ancestor.txt @@ -454,7 +466,6 @@ test/messages/func_e13xx_py30.txt test/messages/func_empty_module.txt test/messages/func_eval_used.txt -test/messages/func_exceptions_raise_type_error.txt test/messages/func_excess_escapes.txt test/messages/func_exec_used_py30.txt test/messages/func_f0001.txt @@ -464,7 +475,6 @@ test/messages/func_format_py27.txt test/messages/func_format_py_27.txt test/messages/func_genexpr_var_scope_py24.txt -test/messages/func_globals.txt test/messages/func_i0011.txt test/messages/func_i0012.txt test/messages/func_i0013.txt @@ -488,17 +498,10 @@ test/messages/func_method_could_be_function.txt test/messages/func_method_missing_self.txt test/messages/func_method_without_self_but_self_assignment.txt -test/messages/func_missing_super_argument_py_30.txt test/messages/func_module___dict__.txt test/messages/func_more_e0604.txt test/messages/func_nameerror_on_string_substitution.txt test/messages/func_names_imported_from_module.txt -test/messages/func_newstyle_exceptions.txt -test/messages/func_newstyle_exceptions_py30.txt -test/messages/func_newstyle_property.txt -test/messages/func_newstyle_property_py30.txt -test/messages/func_newstyle_super.txt -test/messages/func_newstyle_super_py30.txt test/messages/func_no_dummy_redefined.txt test/messages/func_no_final_new_line.txt test/messages/func_non_iterator_returned_py30.txt @@ -516,7 +519,6 @@ test/messages/func_reqattrs.txt test/messages/func_return_outside_func.txt test/messages/func_return_yield_mix_py_33.txt -test/messages/func_scope_regrtest.txt test/messages/func_set_literal_as_default_py27.txt test/messages/func_string_format_py27.txt test/messages/func_superfluous_parens.txt @@ -603,9 +605,6 @@ test/regrtest_data/numarray_import.py test/regrtest_data/numarray_inf.py test/regrtest_data/precedence_test.py -test/regrtest_data/pygtk_enum_crash.py -test/regrtest_data/pygtk_import.py -test/regrtest_data/socketerror_import.py test/regrtest_data/special_attr_scope_lookup_crash.py test/regrtest_data/try_finally_disable_msg_crash.py test/regrtest_data/absimp/__init__.py diff -Nru pylint-1.3.0/test/functional/abstract_abc_methods.args pylint-1.3.1/test/functional/abstract_abc_methods.args --- pylint-1.3.0/test/functional/abstract_abc_methods.args 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/functional/abstract_abc_methods.args 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -[testoptions] -min_pyver=2.6 - diff -Nru pylint-1.3.0/test/functional/abstract_abc_methods.rc pylint-1.3.1/test/functional/abstract_abc_methods.rc --- pylint-1.3.0/test/functional/abstract_abc_methods.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/abstract_abc_methods.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,3 @@ +[testoptions] +min_pyver=2.6 + diff -Nru pylint-1.3.0/test/functional/access_to__name__.py pylint-1.3.1/test/functional/access_to__name__.py --- pylint-1.3.0/test/functional/access_to__name__.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/access_to__name__.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,21 @@ +# pylint: disable=too-few-public-methods,star-args +"""test access to __name__ gives undefined member on new/old class instances +but not on new/old class object +""" + + +class Aaaa: # <3.0:[old-style-class] + """old class""" + def __init__(self): + print self.__name__ # [no-member] + print self.__class__.__name__ + +class NewClass(object): + """new class""" + + def __new__(cls, *args, **kwargs): + print 'new', cls.__name__ + return object.__new__(cls, *args, **kwargs) + + def __init__(self): + print 'init', self.__name__ # [no-member] diff -Nru pylint-1.3.0/test/functional/access_to__name__.txt pylint-1.3.1/test/functional/access_to__name__.txt --- pylint-1.3.0/test/functional/access_to__name__.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/access_to__name__.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,3 @@ +old-style-class:7:Aaaa:Old-style class defined. +no-member:10:Aaaa.__init__:Instance of 'Aaaa' has no '__name__' member +no-member:21:NewClass.__init__:Instance of 'NewClass' has no '__name__' member diff -Nru pylint-1.3.0/test/functional/access_to_protected_members.py pylint-1.3.1/test/functional/access_to_protected_members.py --- pylint-1.3.0/test/functional/access_to_protected_members.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/access_to_protected_members.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,39 @@ +# pylint: disable=too-few-public-methods, W0231 +"""Test external access to protected class members.""" + + +class MyClass(object): + """Class with protected members.""" + _cls_protected = 5 + + def __init__(self, other): + MyClass._cls_protected = 6 + self._protected = 1 + self.public = other + self.attr = 0 + + def test(self): + """Docstring.""" + self._protected += self._cls_protected + print self.public._haha # [protected-access] + + def clsmeth(cls): + """Docstring.""" + cls._cls_protected += 1 + print cls._cls_protected + clsmeth = classmethod(clsmeth) + +class Subclass(MyClass): + """Subclass with protected members.""" + + def __init__(self): + MyClass._protected = 5 + +INST = Subclass() +INST.attr = 1 +print INST.attr +INST._protected = 2 # [protected-access] +print INST._protected # [protected-access] +INST._cls_protected = 3 # [protected-access] +print INST._cls_protected # [protected-access] + diff -Nru pylint-1.3.0/test/functional/access_to_protected_members.txt pylint-1.3.1/test/functional/access_to_protected_members.txt --- pylint-1.3.0/test/functional/access_to_protected_members.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/access_to_protected_members.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,5 @@ +protected-access:18:MyClass.test:Access to a protected member _haha of a client class +protected-access:35::Access to a protected member _protected of a client class +protected-access:36::Access to a protected member _protected of a client class +protected-access:37::Access to a protected member _cls_protected of a client class +protected-access:38::Access to a protected member _cls_protected of a client class diff -Nru pylint-1.3.0/test/functional/anomalous_unicode_escape.args pylint-1.3.1/test/functional/anomalous_unicode_escape.args --- pylint-1.3.0/test/functional/anomalous_unicode_escape.args 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/functional/anomalous_unicode_escape.args 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=2.6 diff -Nru pylint-1.3.0/test/functional/anomalous_unicode_escape.rc pylint-1.3.1/test/functional/anomalous_unicode_escape.rc --- pylint-1.3.0/test/functional/anomalous_unicode_escape.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/anomalous_unicode_escape.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,2 @@ +[testoptions] +min_pyver=2.6 diff -Nru pylint-1.3.0/test/functional/arguments.py pylint-1.3.1/test/functional/arguments.py --- pylint-1.3.0/test/functional/arguments.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/arguments.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,98 @@ +# pylint: disable=too-few-public-methods +"""Test function argument checker""" + +def decorator(fun): + """Decorator""" + return fun + + +class DemoClass(object): + """Test class for method invocations.""" + + @staticmethod + def static_method(arg): + """static method.""" + return arg + arg + + @classmethod + def class_method(cls, arg): + """class method""" + return arg + arg + + def method(self, arg): + """method.""" + return (self, arg) + + @decorator + def decorated_method(self, arg): + """decorated method.""" + return (self, arg) + + +def function_1_arg(first_argument): + """one argument function""" + return first_argument + +def function_3_args(first_argument, second_argument, third_argument): + """three arguments function""" + return first_argument, second_argument, third_argument + +def function_default_arg(one=1, two=2): + """fonction with default value""" + return two, one + + +function_1_arg(420) +function_1_arg() # [no-value-for-parameter] +function_1_arg(1337, 347) # [too-many-function-args] + +function_3_args(420, 789) # [no-value-for-parameter] +# +1:[no-value-for-parameter,no-value-for-parameter,no-value-for-parameter] +function_3_args() +function_3_args(1337, 347, 456) +function_3_args('bab', 'bebe', None, 5.6) # [too-many-function-args] + +function_default_arg(1, two=5) +function_default_arg(two=5) + +function_1_arg(bob=4) # [unexpected-keyword-arg,no-value-for-parameter] +function_default_arg(1, 4, coin="hello") # [unexpected-keyword-arg] + +function_default_arg(1, one=5) # [redundant-keyword-arg] + +# Remaining tests are for coverage of correct names in messages. +LAMBDA = lambda arg: 1 + +LAMBDA() # [no-value-for-parameter] + +def method_tests(): + """"Method invocations.""" + demo = DemoClass() + demo.static_method() # [no-value-for-parameter] + DemoClass.static_method() # [no-value-for-parameter] + + demo.class_method() # [no-value-for-parameter] + DemoClass.class_method() # [no-value-for-parameter] + + demo.method() # [no-value-for-parameter] + DemoClass.method(demo) # [no-value-for-parameter] + + demo.decorated_method() # [no-value-for-parameter] + DemoClass.decorated_method(demo) # [no-value-for-parameter] + +# Test a regression (issue #234) +import sys + +class Text(object): + """ Regression """ + + if sys.version_info > (3,): + def __new__(cls): + """ empty """ + return object.__new__(cls) + else: + def __new__(cls): + """ empty """ + return object.__new__(cls) + +Text() diff -Nru pylint-1.3.0/test/functional/arguments.txt pylint-1.3.1/test/functional/arguments.txt --- pylint-1.3.0/test/functional/arguments.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/arguments.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,20 @@ +no-value-for-parameter:46::No value for argument 'first_argument' in function call +too-many-function-args:47::Too many positional arguments for function call +no-value-for-parameter:49::No value for argument 'third_argument' in function call +no-value-for-parameter:51::No value for argument 'first_argument' in function call +no-value-for-parameter:51::No value for argument 'second_argument' in function call +no-value-for-parameter:51::No value for argument 'third_argument' in function call +too-many-function-args:53::Too many positional arguments for function call +no-value-for-parameter:58::No value for argument 'first_argument' in function call +unexpected-keyword-arg:58::Unexpected keyword argument 'bob' in function call +unexpected-keyword-arg:59::Unexpected keyword argument 'coin' in function call +redundant-keyword-arg:61::Argument 'one' passed by position and keyword in function call +no-value-for-parameter:66::No value for argument 'arg' in lambda call +no-value-for-parameter:71:method_tests:No value for argument 'arg' in staticmethod call +no-value-for-parameter:72:method_tests:No value for argument 'arg' in staticmethod call +no-value-for-parameter:74:method_tests:No value for argument 'arg' in classmethod call +no-value-for-parameter:75:method_tests:No value for argument 'arg' in classmethod call +no-value-for-parameter:77:method_tests:No value for argument 'arg' in method call +no-value-for-parameter:78:method_tests:No value for argument 'arg' in unbound method call +no-value-for-parameter:80:method_tests:No value for argument 'arg' in method call +no-value-for-parameter:81:method_tests:No value for argument 'arg' in unbound method call diff -Nru pylint-1.3.0/test/functional/bad_inline_option.args pylint-1.3.1/test/functional/bad_inline_option.args --- pylint-1.3.0/test/functional/bad_inline_option.args 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/functional/bad_inline_option.args 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -[Messages Control] -enable=I diff -Nru pylint-1.3.0/test/functional/bad_inline_option.rc pylint-1.3.1/test/functional/bad_inline_option.rc --- pylint-1.3.0/test/functional/bad_inline_option.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/bad_inline_option.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,2 @@ +[Messages Control] +enable=I diff -Nru pylint-1.3.0/test/functional/class_scope.py pylint-1.3.1/test/functional/class_scope.py --- pylint-1.3.0/test/functional/class_scope.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/class_scope.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,22 @@ +# pylint: disable=R0903,W0232 +"""check for scope problems""" + +__revision__ = None + +class Well(object): + """well""" + attr = 42 + get_attr = lambda arg=attr: arg * 24 + # +1: [used-before-assignment] + get_attr_bad = lambda arg=revattr: revattr * 42 + revattr = 24 + bad_lambda = lambda: get_attr_bad # [undefined-variable] + + class Data(object): + """base hidden class""" + class Sub(Data): # [undefined-variable + """whaou, is Data found???""" + attr = Data() # [undefined-variable] + def func(self): + """check Sub is not defined here""" + return Sub(), self # [undefined-variable] diff -Nru pylint-1.3.0/test/functional/class_scope.txt pylint-1.3.1/test/functional/class_scope.txt --- pylint-1.3.0/test/functional/class_scope.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/class_scope.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,4 @@ +used-before-assignment:11:Well.<lambda>:Using variable 'revattr' before assignment +undefined-variable:13:Well.<lambda>:Undefined variable 'get_attr_bad' +undefined-variable:19:Well.Sub:Undefined variable 'Data' +undefined-variable:22:Well.func:Undefined variable 'Sub' diff -Nru pylint-1.3.0/test/functional/duplicate_dict_literal_key.py pylint-1.3.1/test/functional/duplicate_dict_literal_key.py --- pylint-1.3.0/test/functional/duplicate_dict_literal_key.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/duplicate_dict_literal_key.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,14 @@ +"""Check multiple key definition""" +#pylint: disable=C0103 + +correct_dict = { + 'tea': 'for two', + 'two': 'for tea', +} + +wrong_dict = { # [duplicate-key] + 'tea': 'for two', + 'two': 'for tea', + 'tea': 'time', + +} diff -Nru pylint-1.3.0/test/functional/duplicate_dict_literal_key.txt pylint-1.3.1/test/functional/duplicate_dict_literal_key.txt --- pylint-1.3.0/test/functional/duplicate_dict_literal_key.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/duplicate_dict_literal_key.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1 @@ +duplicate-key:9::Duplicate key 'tea' in dictionary diff -Nru pylint-1.3.0/test/functional/future_unicode_literals.args pylint-1.3.1/test/functional/future_unicode_literals.args --- pylint-1.3.0/test/functional/future_unicode_literals.args 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/functional/future_unicode_literals.args 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=2.6 \ No newline at end of file diff -Nru pylint-1.3.0/test/functional/future_unicode_literals.rc pylint-1.3.1/test/functional/future_unicode_literals.rc --- pylint-1.3.0/test/functional/future_unicode_literals.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/future_unicode_literals.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,2 @@ +[testoptions] +min_pyver=2.6 \ No newline at end of file diff -Nru pylint-1.3.0/test/functional/globals.py pylint-1.3.1/test/functional/globals.py --- pylint-1.3.0/test/functional/globals.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/globals.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,24 @@ +"""Warnings about global statements and usage of global variables.""" + +global CSTE # [global-at-module-level] +print CSTE # [undefined-variable] + +CONSTANT = 1 + +def fix_contant(value): + """all this is ok, but try not using global ;)""" + global CONSTANT # [global-statement] + print CONSTANT + CONSTANT = value + + +def other(): + """global behaviour test""" + global HOP # [global-variable-not-assigned] + print HOP # [undefined-variable] + + +def define_constant(): + """ok but somevar is not defined at the module scope""" + global SOMEVAR # [global-variable-undefined] + SOMEVAR = 2 diff -Nru pylint-1.3.0/test/functional/globals.txt pylint-1.3.1/test/functional/globals.txt --- pylint-1.3.0/test/functional/globals.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/globals.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,6 @@ +global-at-module-level:3::Using the global statement at the module level +undefined-variable:4::Undefined variable 'CSTE' +global-statement:10:fix_contant:Using the global statement +global-variable-not-assigned:17:other:Using global for 'HOP' but no assignment is done +undefined-variable:18:other:Undefined variable 'HOP' +global-variable-undefined:23:define_constant:Global variable 'SOMEVAR' undefined at the module level diff -Nru pylint-1.3.0/test/functional/invalid__all__object.py pylint-1.3.1/test/functional/invalid__all__object.py --- pylint-1.3.0/test/functional/invalid__all__object.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/invalid__all__object.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,3 @@ +"""Test that non-inferable __all__ variables do not make Pylint crash.""" + +__all__ = [SomeUndefinedName] # [undefined-variable] diff -Nru pylint-1.3.0/test/functional/invalid__all__object.txt pylint-1.3.1/test/functional/invalid__all__object.txt --- pylint-1.3.0/test/functional/invalid__all__object.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/invalid__all__object.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1 @@ +undefined-variable:3::Undefined variable 'SomeUndefinedName' diff -Nru pylint-1.3.0/test/functional/invalid_exceptions_raised.py pylint-1.3.1/test/functional/invalid_exceptions_raised.py --- pylint-1.3.0/test/functional/invalid_exceptions_raised.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/invalid_exceptions_raised.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,51 @@ +# pylint:disable=too-few-public-methods,old-style-class,no-init +"""test pb with exceptions and old/new style classes""" + + +class ValidException(Exception): + """Valid Exception.""" + +class OldStyleClass: + """Not an exception.""" + +class NewStyleClass(object): + """Not an exception.""" + + +def good_case(): + """raise""" + raise ValidException('hop') + +def bad_case0(): + """raise""" + # +2:<3.0:[nonstandard-exception] + # +1:>=3.0:[raising-non-exception] + raise OldStyleClass('hop') + +def bad_case1(): + """raise""" + raise NewStyleClass() # [raising-non-exception] + +def bad_case2(): + """raise""" + # +2:<3.0:[old-raise-syntax,nonstandard-exception] + # +1:>=3.0:[raising-non-exception] + raise OldStyleClass, 'hop' + +def bad_case3(): + """raise""" + raise NewStyleClass # [raising-non-exception] + +def bad_case4(): + """raise""" + # +1:<3.0:[old-raise-syntax] + raise NotImplemented, 'hop' # [notimplemented-raised] + +def bad_case5(): + """raise""" + raise 1 # [raising-bad-type] + +def base_case6(): + """raise""" + raise None # [raising-bad-type] + diff -Nru pylint-1.3.0/test/functional/invalid_exceptions_raised.txt pylint-1.3.1/test/functional/invalid_exceptions_raised.txt --- pylint-1.3.0/test/functional/invalid_exceptions_raised.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/invalid_exceptions_raised.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,11 @@ +raising-non-exception:23:bad_case0:Raising a new style class which doesn't inherit from BaseException +nonstandard-exception:23:bad_case0:Exception doesn't inherit from standard "Exception" class +raising-non-exception:27:bad_case1:Raising a new style class which doesn't inherit from BaseException +raising-non-exception:33:bad_case2:Raising a new style class which doesn't inherit from BaseException +nonstandard-exception:33:bad_case2:Exception doesn't inherit from standard "Exception" class +old-raise-syntax:33:bad_case2:Use raise ErrorClass(args) instead of raise ErrorClass, args. +raising-non-exception:37:bad_case3:Raising a new style class which doesn't inherit from BaseException +notimplemented-raised:42:bad_case4:NotImplemented raised - should raise NotImplementedError +old-raise-syntax:42:bad_case4:Use raise ErrorClass(args) instead of raise ErrorClass, args. +raising-bad-type:46:bad_case5:Raising int while only classes, instances or string are allowed +raising-bad-type:50:base_case6:Raising NoneType while only classes, instances or string are allowed diff -Nru pylint-1.3.0/test/functional/namedtuple_member_inference.args pylint-1.3.1/test/functional/namedtuple_member_inference.args --- pylint-1.3.0/test/functional/namedtuple_member_inference.args 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/functional/namedtuple_member_inference.args 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=2.6 diff -Nru pylint-1.3.0/test/functional/namedtuple_member_inference.rc pylint-1.3.1/test/functional/namedtuple_member_inference.rc --- pylint-1.3.0/test/functional/namedtuple_member_inference.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/namedtuple_member_inference.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,2 @@ +[testoptions] +min_pyver=2.6 diff -Nru pylint-1.3.0/test/functional/names_in__all__.py pylint-1.3.1/test/functional/names_in__all__.py --- pylint-1.3.0/test/functional/names_in__all__.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/names_in__all__.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,46 @@ +# pylint: disable=too-few-public-methods,no-self-use +"""Test Pylint's use of __all__. + +* NonExistant is not defined in this module, and it is listed in + __all__. An error is expected. + +* This module imports path and republished it in __all__. No errors + are expected. +""" + + +from os import path +from collections import deque + +__all__ = [ + 'Dummy', + 'NonExistant', # [undefined-all-variable] + 'path', + 'func', # [undefined-all-variable] + 'inner', # [undefined-all-variable] + 'InnerKlass', deque.__name__] # [undefined-all-variable] + + +class Dummy(object): + """A class defined in this module.""" + pass + +DUMMY = Dummy() + +def function(): + """Function docstring + """ + pass + +function() + +class Klass(object): + """A klass which contains a function""" + def func(self): + """A klass method""" + inner = None + print inner + + class InnerKlass(object): + """A inner klass""" + pass diff -Nru pylint-1.3.0/test/functional/names_in__all__.txt pylint-1.3.1/test/functional/names_in__all__.txt --- pylint-1.3.0/test/functional/names_in__all__.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/names_in__all__.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,4 @@ +undefined-all-variable:17::Undefined variable name 'NonExistant' in __all__ +undefined-all-variable:19::Undefined variable name 'func' in __all__ +undefined-all-variable:20::Undefined variable name 'inner' in __all__ +undefined-all-variable:21::Undefined variable name 'InnerKlass' in __all__ diff -Nru pylint-1.3.0/test/functional/name_styles.args pylint-1.3.1/test/functional/name_styles.args --- pylint-1.3.0/test/functional/name_styles.args 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/functional/name_styles.args 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -[testoptions] -min_pyver=2.6 - -[Messages Control] -disable=too-few-public-methods,abstract-class-not-used,global-statement diff -Nru pylint-1.3.0/test/functional/name_styles.rc pylint-1.3.1/test/functional/name_styles.rc --- pylint-1.3.0/test/functional/name_styles.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/name_styles.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,5 @@ +[testoptions] +min_pyver=2.6 + +[Messages Control] +disable=too-few-public-methods,abstract-class-not-used,global-statement diff -Nru pylint-1.3.0/test/functional/newstyle_properties.py pylint-1.3.1/test/functional/newstyle_properties.py --- pylint-1.3.0/test/functional/newstyle_properties.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/newstyle_properties.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,53 @@ +# pylint: disable=too-few-public-methods +"""Test properties on old style classes and property.setter/deleter usage""" + + +def getter(self): + """interesting""" + return self + +class CorrectClass(object): + """correct usage""" + method = property(getter, doc='hop') + +class OldStyleClass: # <3.0:[old-style-class] + """bad usage""" + method = property(getter, doc='hop') # <3.0:[property-on-old-class] + + def __init__(self): + pass + + +def decorator(func): + """Redefining decorator.""" + def wrapped(self): + """Wrapper function.""" + return func(self) + return wrapped + + +class SomeClass(object): + """another docstring""" + + def __init__(self): + self._prop = None + + @property + def prop(self): + """I'm the 'prop' property.""" + return self._prop + + @prop.setter + def prop(self, value): + """I'm the 'prop' property.""" + self._prop = value + + @prop.deleter + def prop(self): + """I'm the 'prop' property.""" + del self._prop + + @decorator + def noregr(self): + """Just a normal method with a decorator.""" + return self.prop diff -Nru pylint-1.3.0/test/functional/newstyle_properties.txt pylint-1.3.1/test/functional/newstyle_properties.txt --- pylint-1.3.0/test/functional/newstyle_properties.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/newstyle_properties.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,2 @@ +old-style-class:13:OldStyleClass:Old-style class defined. +property-on-old-class:15:OldStyleClass:Use of "property" on an old style class diff -Nru pylint-1.3.0/test/functional/pygtk_enum_crash.py pylint-1.3.1/test/functional/pygtk_enum_crash.py --- pylint-1.3.0/test/functional/pygtk_enum_crash.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/pygtk_enum_crash.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,11 @@ +# pylint: disable=C0121 +"""http://www.logilab.org/ticket/124337""" + +import gtk + +def print_some_constant(arg=gtk.BUTTONS_OK): + """crash because gtk.BUTTONS_OK, a gtk enum type, is returned by + astroid as a constant + """ + print arg + diff -Nru pylint-1.3.0/test/functional/pygtk_enum_crash.rc pylint-1.3.1/test/functional/pygtk_enum_crash.rc --- pylint-1.3.0/test/functional/pygtk_enum_crash.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/pygtk_enum_crash.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,2 @@ +[testoptions] +requires=gtk diff -Nru pylint-1.3.0/test/functional/pygtk_import.py pylint-1.3.1/test/functional/pygtk_import.py --- pylint-1.3.0/test/functional/pygtk_import.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/pygtk_import.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,14 @@ +"""Import PyGTK.""" +#pylint: disable=too-few-public-methods,too-many-public-methods + +from gtk import VBox +import gtk + +class FooButton(gtk.Button): + """extend gtk.Button""" + def extend(self): + """hop""" + print self + +print gtk.Button +print VBox diff -Nru pylint-1.3.0/test/functional/pygtk_import.rc pylint-1.3.1/test/functional/pygtk_import.rc --- pylint-1.3.0/test/functional/pygtk_import.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/pygtk_import.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,2 @@ +[testoptions] +requires=gtk diff -Nru pylint-1.3.0/test/functional/socketerror_import.py pylint-1.3.1/test/functional/socketerror_import.py --- pylint-1.3.0/test/functional/socketerror_import.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/socketerror_import.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,6 @@ +"""ds""" + +__revision__ = '$Id: socketerror_import.py,v 1.2 2005-12-28 14:58:22 syt Exp $' + +from socket import error +print error diff -Nru pylint-1.3.0/test/functional/string_formatting.py pylint-1.3.1/test/functional/string_formatting.py --- pylint-1.3.0/test/functional/string_formatting.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/string_formatting.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,121 @@ +"""test for Python 3 string formatting error +""" +# pylint: disable=too-few-public-methods, import-error, unused-argument, star-args, line-too-long +import os +from missing import Missing + +__revision__ = 1 + +class Custom(object): + """ Has a __getattr__ """ + def __getattr__(self): + return self + +class Test(object): + """ test format attribute access """ + custom = Custom() + ids = [1, 2, 3, [4, 5, 6]] + +class Getitem(object): + """ test custom getitem for lookup access """ + def __getitem__(self, index): + return 42 + +class ReturnYes(object): + """ can't be properly infered """ + missing = Missing() + +def log(message, message_type="error"): + """ Test """ + return message + +def print_good(): + """ Good format strings """ + "{0} {1}".format(1, 2) + "{0!r:20}".format("Hello") + "{!r:20}".format("Hello") + "{a!r:20}".format(a="Hello") + "{pid}".format(pid=os.getpid()) + str("{}").format(2) + "{0.missing.length}".format(ReturnYes()) + "{1.missing.length}".format(ReturnYes()) + "{a.ids[3][1]}".format(a=Test()) + "{a[0][0]}".format(a=[[1]]) + "{[0][0]}".format({0: {0: 1}}) + "{a.test}".format(a=Custom()) + "{a.__len__}".format(a=[]) + "{a.ids.__len__}".format(a=Test()) + "{a[0]}".format(a=Getitem()) + "{a[0][0]}".format(a=[Getitem()]) + "{[0][0]}".format(["test"]) + # these are skipped + "{0} {1}".format(*[1, 2]) + "{a} {b}".format(**{'a': 1, 'b': 2}) + "{a}".format(a=Missing()) + +def pprint_bad(): + """Test string format """ + "{{}}".format(1) # [too-many-format-args] + "{} {".format() # [bad-format-string] + "{} }".format() # [bad-format-string] + "{0} {}".format(1, 2) # [format-combined-specification] + # +1: [missing-format-argument-key, unused-format-string-argument] + "{a} {b}".format(a=1, c=2) + "{} {a}".format(1, 2) # [missing-format-argument-key] + "{} {}".format(1) # [too-few-format-args] + "{} {}".format(1, 2, 3) # [too-many-format-args] + # +1: [missing-format-argument-key,missing-format-argument-key,missing-format-argument-key] + "{a} {b} {c}".format() + "{} {}".format(a=1, b=2) # [too-few-format-args] + # +1: [missing-format-argument-key, missing-format-argument-key] + "{a} {b}".format(1, 2) + "{0} {1} {a}".format(1, 2, 3) # [missing-format-argument-key] + # +1: [missing-format-attribute] + "{a.ids.__len__.length}".format(a=Test()) + "{a.ids[3][400]}".format(a=Test()) # [invalid-format-index] + "{a.ids[3]['string']}".format(a=Test()) # [invalid-format-index] + "{[0][1]}".format(["a"]) # [invalid-format-index] + "{[0][0]}".format(((1, ))) # [invalid-format-index] + # +1: [missing-format-argument-key, unused-format-string-argument] + "{b[0]}".format(a=23) + "{a[0]}".format(a=object) # [invalid-format-index] + log("{}".format(2, "info")) # [too-many-format-args] + "{0.missing}".format(2) # [missing-format-attribute] + "{0} {1} {2}".format(1, 2) # [too-few-format-args] + "{0} {1}".format(1, 2, 3) # [too-many-format-args] + "{0} {a}".format(a=4) # [too-few-format-args] + "{[0]} {}".format([4]) # [too-few-format-args] + "{[0]} {}".format([4], 5, 6) # [too-many-format-args] + +def good_issue288(*args, **kwargs): + """ Test that using kwargs does not emit a false + positive. + """ + 'Hello John Doe {0[0]}'.format(args) + 'Hello {0[name]}'.format(kwargs) + +def good_issue287(): + """ Test that the string format checker skips + format nodes which don't have a string as a parent + (but a subscript, name etc). + """ + name = 'qwerty' + ret = {'comment': ''} + ret['comment'] = 'MySQL grant {0} is set to be revoked' + ret['comment'] = ret['comment'].format(name) + return ret, name + +def nested_issue294(): + """ Test nested format fields. """ + '{0:>{1}}'.format(42, 24) + '{0:{a[1]}} {a}'.format(1, a=[1, 2]) + '{:>{}}'.format(42, 24) + '{0:>{1}}'.format(42) # [too-few-format-args] + '{0:>{1}}'.format(42, 24, 54) # [too-many-format-args] + '{0:{a[1]}}'.format(1) # [missing-format-argument-key] + '{0:{a.x}}'.format(1, a=2) # [missing-format-attribute] + +def issue310(): + """ Test a regression using duplicate manual position arguments. """ + '{0} {1} {0}'.format(1, 2) + '{0} {1} {0}'.format(1) # [too-few-format-args] diff -Nru pylint-1.3.0/test/functional/string_formatting_py27.py pylint-1.3.1/test/functional/string_formatting_py27.py --- pylint-1.3.0/test/functional/string_formatting_py27.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/string_formatting_py27.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,23 @@ +"""test for Python 2 string formatting error +""" +from __future__ import unicode_literals +# pylint: disable=line-too-long +__revision__ = 1 + +def pprint_bad(): + """Test string format """ + "{{}}".format(1) # [too-many-format-args] + "{} {".format() # [bad-format-string] + "{} }".format() # [bad-format-string] + "{0} {}".format(1, 2) # [format-combined-specification] + # +1: [missing-format-argument-key, unused-format-string-argument] + "{a} {b}".format(a=1, c=2) + "{} {a}".format(1, 2) # [missing-format-argument-key] + "{} {}".format(1) # [too-few-format-args] + "{} {}".format(1, 2, 3) # [too-many-format-args] + # +1: [missing-format-argument-key,missing-format-argument-key,missing-format-argument-key] + "{a} {b} {c}".format() + "{} {}".format(a=1, b=2) # [too-few-format-args] + # +1: [missing-format-argument-key, missing-format-argument-key] + "{a} {b}".format(1, 2) + diff -Nru pylint-1.3.0/test/functional/string_formatting_py27.rc pylint-1.3.1/test/functional/string_formatting_py27.rc --- pylint-1.3.0/test/functional/string_formatting_py27.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/string_formatting_py27.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,3 @@ +[testoptions] +min_pyver=2.7 +max_pyver=3.0 \ No newline at end of file diff -Nru pylint-1.3.0/test/functional/string_formatting_py27.txt pylint-1.3.1/test/functional/string_formatting_py27.txt --- pylint-1.3.0/test/functional/string_formatting_py27.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/string_formatting_py27.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,15 @@ +too-many-format-args:9:pprint_bad:Too many arguments for format string +bad-format-string:10:pprint_bad:Invalid format string +bad-format-string:11:pprint_bad:Invalid format string +format-combined-specification:12:pprint_bad:Format string contains both automatic field numbering and manual field specification +missing-format-argument-key:14:pprint_bad:Missing keyword argument u'b' for format string +unused-format-string-argument:14:pprint_bad:Unused format argument 'c' +missing-format-argument-key:15:pprint_bad:Missing keyword argument u'a' for format string +too-few-format-args:16:pprint_bad:Not enough arguments for format string +too-many-format-args:17:pprint_bad:Too many arguments for format string +missing-format-argument-key:19:pprint_bad:Missing keyword argument u'a' for format string +missing-format-argument-key:19:pprint_bad:Missing keyword argument u'b' for format string +missing-format-argument-key:19:pprint_bad:Missing keyword argument u'c' for format string +too-few-format-args:20:pprint_bad:Not enough arguments for format string +missing-format-argument-key:22:pprint_bad:Missing keyword argument u'a' for format string +missing-format-argument-key:22:pprint_bad:Missing keyword argument u'b' for format string diff -Nru pylint-1.3.0/test/functional/string_formatting.txt pylint-1.3.1/test/functional/string_formatting.txt --- pylint-1.3.0/test/functional/string_formatting.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/string_formatting.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,36 @@ +too-many-format-args:58:pprint_bad:Too many arguments for format string +bad-format-string:59:pprint_bad:Invalid format string +bad-format-string:60:pprint_bad:Invalid format string +format-combined-specification:61:pprint_bad:Format string contains both automatic field numbering and manual field specification +missing-format-argument-key:63:pprint_bad:Missing keyword argument 'b' for format string +unused-format-string-argument:63:pprint_bad:Unused format argument 'c' +missing-format-argument-key:64:pprint_bad:Missing keyword argument 'a' for format string +too-few-format-args:65:pprint_bad:Not enough arguments for format string +too-many-format-args:66:pprint_bad:Too many arguments for format string +missing-format-argument-key:68:pprint_bad:Missing keyword argument 'a' for format string +missing-format-argument-key:68:pprint_bad:Missing keyword argument 'b' for format string +missing-format-argument-key:68:pprint_bad:Missing keyword argument 'c' for format string +too-few-format-args:69:pprint_bad:Not enough arguments for format string +missing-format-argument-key:71:pprint_bad:Missing keyword argument 'a' for format string +missing-format-argument-key:71:pprint_bad:Missing keyword argument 'b' for format string +missing-format-argument-key:72:pprint_bad:Missing keyword argument 'a' for format string +missing-format-attribute:74:pprint_bad:Missing format attribute 'length' in format specifier 'a.ids.__len__.length' +invalid-format-index:75:pprint_bad:Using invalid lookup key 400 in format specifier 'a.ids[3][400]' +invalid-format-index:76:pprint_bad:Using invalid lookup key "'string'" in format specifier 'a.ids[3]["\'string\'"]' +invalid-format-index:77:pprint_bad:Using invalid lookup key 1 in format specifier '0[0][1]' +invalid-format-index:78:pprint_bad:Using invalid lookup key 0 in format specifier '0[0][0]' +missing-format-argument-key:80:pprint_bad:Missing keyword argument 'b' for format string +unused-format-string-argument:80:pprint_bad:Unused format argument 'a' +invalid-format-index:81:pprint_bad:Using invalid lookup key 0 in format specifier 'a[0]' +too-many-format-args:82:pprint_bad:Too many arguments for format string +missing-format-attribute:83:pprint_bad:Missing format attribute 'missing' in format specifier '0.missing' +too-few-format-args:84:pprint_bad:Not enough arguments for format string +too-many-format-args:85:pprint_bad:Too many arguments for format string +too-few-format-args:86:pprint_bad:Not enough arguments for format string +too-few-format-args:87:pprint_bad:Not enough arguments for format string +too-many-format-args:88:pprint_bad:Too many arguments for format string +too-few-format-args:113:nested_issue294:Not enough arguments for format string +too-many-format-args:114:nested_issue294:Too many arguments for format string +missing-format-argument-key:115:nested_issue294:Missing keyword argument 'a' for format string +missing-format-attribute:116:nested_issue294:Missing format attribute 'x' in format specifier 'a.x' +too-few-format-args:121:issue310:Not enough arguments for format string diff -Nru pylint-1.3.0/test/functional/super_checks.py pylint-1.3.1/test/functional/super_checks.py --- pylint-1.3.0/test/functional/super_checks.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/super_checks.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,46 @@ +# pylint: disable=too-few-public-methods,import-error +"""check use of super""" + +from unknown import Missing + +class Aaaa: # <3.0:[old-style-class] + """old style""" + def hop(self): # <3.0:[super-on-old-class] + """hop""" + super(Aaaa, self).hop() + + def __init__(self): # <3.0:[super-on-old-class] + super(Aaaa, self).__init__() + +class NewAaaa(object): + """old style""" + def hop(self): + """hop""" + super(NewAaaa, self).hop() + + def __init__(self): + super(object, self).__init__() # [bad-super-call] + +class Py3kAaaa(NewAaaa): + """new style""" + def __init__(self): + super().__init__() # <3.0:[missing-super-argument] + +class Py3kWrongSuper(Py3kAaaa): + """new style""" + def __init__(self): + super(NewAaaa, self).__init__() # [bad-super-call] + +class WrongNameRegression(Py3kAaaa): + """ test a regression with the message """ + def __init__(self): + super(Missing, self).__init__() # [bad-super-call] + +class Getattr(object): + """ crash """ + name = NewAaaa + +class CrashSuper(object): + """ test a crash with this checker """ + def __init__(self): + super(Getattr.name, self).__init__() # [bad-super-call] diff -Nru pylint-1.3.0/test/functional/super_checks.txt pylint-1.3.1/test/functional/super_checks.txt --- pylint-1.3.0/test/functional/super_checks.txt 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/super_checks.txt 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,8 @@ +old-style-class:6:Aaaa:Old-style class defined. +super-on-old-class:8:Aaaa.hop:Use of super on an old style class +super-on-old-class:12:Aaaa.__init__:Use of super on an old style class +bad-super-call:22:NewAaaa.__init__:Bad first argument 'object' given to super() +missing-super-argument:27:Py3kAaaa.__init__:Missing argument to super() +bad-super-call:32:Py3kWrongSuper.__init__:Bad first argument 'NewAaaa' given to super() +bad-super-call:37:WrongNameRegression.__init__:Bad first argument 'Missing' given to super() +bad-super-call:46:CrashSuper.__init__:Bad first argument 'NewAaaa' given to super() diff -Nru pylint-1.3.0/test/functional/suspicious_str_strip_call.args pylint-1.3.1/test/functional/suspicious_str_strip_call.args --- pylint-1.3.0/test/functional/suspicious_str_strip_call.args 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/functional/suspicious_str_strip_call.args 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -[testoptions] -min_pyver=2.6 -max_pyver=3.0 diff -Nru pylint-1.3.0/test/functional/suspicious_str_strip_call_py3.args pylint-1.3.1/test/functional/suspicious_str_strip_call_py3.args --- pylint-1.3.0/test/functional/suspicious_str_strip_call_py3.args 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/functional/suspicious_str_strip_call_py3.args 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.0 diff -Nru pylint-1.3.0/test/functional/suspicious_str_strip_call_py3.rc pylint-1.3.1/test/functional/suspicious_str_strip_call_py3.rc --- pylint-1.3.0/test/functional/suspicious_str_strip_call_py3.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/suspicious_str_strip_call_py3.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,2 @@ +[testoptions] +min_pyver=3.0 diff -Nru pylint-1.3.0/test/functional/suspicious_str_strip_call.rc pylint-1.3.1/test/functional/suspicious_str_strip_call.rc --- pylint-1.3.0/test/functional/suspicious_str_strip_call.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/suspicious_str_strip_call.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,3 @@ +[testoptions] +min_pyver=2.6 +max_pyver=3.0 diff -Nru pylint-1.3.0/test/functional/uninferable_all_object.py pylint-1.3.1/test/functional/uninferable_all_object.py --- pylint-1.3.0/test/functional/uninferable_all_object.py 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/uninferable_all_object.py 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,9 @@ +"""Test that non-inferable __all__ variables do not make Pylint crash.""" + +__all__ = sorted([ + 'Dummy', + 'NonExistant', + 'path', + 'func', + 'inner', + 'InnerKlass']) diff -Nru pylint-1.3.0/test/functional/unpacked_exceptions.args pylint-1.3.1/test/functional/unpacked_exceptions.args --- pylint-1.3.0/test/functional/unpacked_exceptions.args 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/functional/unpacked_exceptions.args 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -[testoptions] -max_pyver=3.0 diff -Nru pylint-1.3.0/test/functional/unpacked_exceptions.rc pylint-1.3.1/test/functional/unpacked_exceptions.rc --- pylint-1.3.0/test/functional/unpacked_exceptions.rc 1970-01-01 01:00:00.000000000 +0100 +++ pylint-1.3.1/test/functional/unpacked_exceptions.rc 2014-08-24 21:58:08.000000000 +0100 @@ -0,0 +1,2 @@ +[testoptions] +max_pyver=3.0 diff -Nru pylint-1.3.0/test/functional/unpacked_exceptions.txt pylint-1.3.1/test/functional/unpacked_exceptions.txt --- pylint-1.3.0/test/functional/unpacked_exceptions.txt 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/functional/unpacked_exceptions.txt 2014-08-24 21:58:08.000000000 +0100 @@ -1,4 +1,4 @@ unpacking-in-except:7:new_style:Implicit unpacking of exceptions is not supported in Python 3 -unpacking-in-except:10:new_style:Implicit unpacking of exceptions is not supported in Python 3 redefine-in-handler:10:new_style:Redefining name 'new_style' from outer scope (line 3) in exception handler redefine-in-handler:10:new_style:Redefining name 'tuple' from builtins in exception handler +unpacking-in-except:10:new_style:Implicit unpacking of exceptions is not supported in Python 3 diff -Nru pylint-1.3.0/test/input/func_all.py pylint-1.3.1/test/input/func_all.py --- pylint-1.3.0/test/input/func_all.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_all.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,46 +0,0 @@ -"""Test Pylint's use of __all__. - -* NonExistant is not defined in this module, and it is listed in - __all__. An error is expected. - -* This module imports path and republished it in __all__. No errors - are expected. -""" -# pylint: disable=R0903,R0201,W0612 - -__revision__ = 0 - -from os import path -from collections import deque - -__all__ = [ - 'Dummy', - 'NonExistant', - 'path', - 'func', - 'inner', - 'InnerKlass', deque.__name__] - - -class Dummy(object): - """A class defined in this module.""" - pass - -DUMMY = Dummy() - -def function(): - """Function docstring - """ - pass - -function() - -class Klass(object): - """A klass which contains a function""" - def func(self): - """A klass method""" - inner = None - - class InnerKlass(object): - """A inner klass""" - pass diff -Nru pylint-1.3.0/test/input/func_all_undefined.py pylint-1.3.1/test/input/func_all_undefined.py --- pylint-1.3.0/test/input/func_all_undefined.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_all_undefined.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -"""Test that non-inferable __all__ variables do not make Pylint crash. - -""" -# pylint: disable=R0903,R0201,W0612 - -__revision__ = 0 - -__all__ = [SomeUndefinedName] diff -Nru pylint-1.3.0/test/input/func_arguments.py pylint-1.3.1/test/input/func_arguments.py --- pylint-1.3.0/test/input/func_arguments.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_arguments.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,100 +0,0 @@ -"""Test function argument checker""" -__revision__ = '' - -def decorator(fun): - """Decorator""" - return fun - - -class DemoClass(object): - """Test class for method invocations.""" - - @staticmethod - def static_method(arg): - """static method.""" - return arg + arg - - @classmethod - def class_method(cls, arg): - """class method""" - return arg + arg - - def method(self, arg): - """method.""" - return (self, arg) - - @decorator - def decorated_method(self, arg): - """decorated method.""" - return (self, arg) - - -def function_1_arg(first_argument): - """one argument function""" - return first_argument - -def function_3_args(first_argument, second_argument, third_argument): - """three arguments function""" - return first_argument, second_argument, third_argument - -def function_default_arg(one=1, two=2): - """fonction with default value""" - return two, one - - -function_1_arg(420) -function_1_arg() -function_1_arg(1337, 347) - -function_3_args(420, 789) -function_3_args() -function_3_args(1337, 347, 456) -function_3_args('bab', 'bebe', None, 5.6) - -function_default_arg(1, two=5) -function_default_arg(two=5) -# repeated keyword is syntax error in python >= 2.6: -# tests are moved to func_keyword_repeat_py25- / func_keyword_repeat_py26 - -function_1_arg(bob=4) -function_default_arg(1, 4, coin="hello") - -function_default_arg(1, one=5) - -# Remaining tests are for coverage of correct names in messages. -LAMBDA = lambda arg: 1 - -LAMBDA() - -def method_tests(): - """"Method invocations.""" - demo = DemoClass() - demo.static_method() - DemoClass.static_method() - - demo.class_method() - DemoClass.class_method() - - demo.method() - DemoClass.method(demo) - - demo.decorated_method() - DemoClass.decorated_method(demo) - -# Test a regression (issue #234) -import sys - -# pylint: disable=too-few-public-methods -class Text(object): - """ Regression """ - - if sys.version_info > (3,): - def __new__(cls): - """ empty """ - return object.__new__(cls) - else: - def __new__(cls): - """ empty """ - return object.__new__(cls) - -Text() diff -Nru pylint-1.3.0/test/input/func_class_access_protected_members.py pylint-1.3.1/test/input/func_class_access_protected_members.py --- pylint-1.3.0/test/input/func_class_access_protected_members.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_class_access_protected_members.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,36 +0,0 @@ -# pylint: disable=R0903, C0111, W0231 -"""test external access to protected class members""" - -__revision__ = '' - -class MyClass(object): - _cls_protected = 5 - - def __init__(self, other): - MyClass._cls_protected = 6 - self._protected = 1 - self.public = other - self.attr = 0 - - def test(self): - self._protected += self._cls_protected - print self.public._haha - - def clsmeth(cls): - cls._cls_protected += 1 - print cls._cls_protected - clsmeth = classmethod(clsmeth) - -class Subclass(MyClass): - - def __init__(self): - MyClass._protected = 5 - -INST = Subclass() -INST.attr = 1 -print INST.attr -INST._protected = 2 -print INST._protected -INST._cls_protected = 3 -print INST._cls_protected - diff -Nru pylint-1.3.0/test/input/func_dict_keys.py pylint-1.3.1/test/input/func_dict_keys.py --- pylint-1.3.0/test/input/func_dict_keys.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_dict_keys.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -"""Check multiple key definition""" -#pylint: disable=C0103 -__revision__ = 5 - -correct_dict = { - 'tea': 'for two', - 'two': 'for tea', -} - -wrong_dict = { - 'tea': 'for two', - 'two': 'for tea', - 'tea': 'time', - -} diff -Nru pylint-1.3.0/test/input/func_exceptions_raise_type_error.py pylint-1.3.1/test/input/func_exceptions_raise_type_error.py --- pylint-1.3.0/test/input/func_exceptions_raise_type_error.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_exceptions_raise_type_error.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -""" -'E0702': Raising an %s while only classes, instances or string are allowed - -Used when something which is neither a class, an instance or a string is -raised (i.e. a `TypeError` will be raised). -""" - -__revision__ = 1 - -if __revision__: - raise 1 - -if __revision__: - raise None diff -Nru pylint-1.3.0/test/input/func_globals.py pylint-1.3.1/test/input/func_globals.py --- pylint-1.3.0/test/input/func_globals.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_globals.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,40 +0,0 @@ -""" -'W0601': ('global variable %s undefined at the module level', - 'Used when a variable is defined through the "global" statement \ - but the variable is not defined in the module scope.'), -'W0602': ('Using global for %s but no assignment is done', - 'Used when a variable is defined through the "global" statement \ - but no assignment to this variable is done.'), -'W0603': ('Using the global statement', # W0121 - 'Used when you use the "global" statement to update a global \ - variable. Pylint just try to discourage this \ - usage. That doesn\'t mean you can not use it !'), -'W0604': ('Using the global statement at the module level', # W0103 - 'Used when you use the "global" statement at the module level \ - since it has no effect'), -""" - -__revision__ = '' - -CONSTANT = 1 - -def fix_contant(value): - """all this is ok, but try not using global ;)""" - global CONSTANT - print CONSTANT - CONSTANT = value -global CSTE # useless -print CSTE # ko - -def other(): - """global behaviour test""" - global HOP - print HOP # ko - -other() - - -def define_constant(): - """ok but somevar is not defined at the module scope""" - global SOMEVAR - SOMEVAR = 2 diff -Nru pylint-1.3.0/test/input/func_missing_super_argument_py_30.py pylint-1.3.1/test/input/func_missing_super_argument_py_30.py --- pylint-1.3.0/test/input/func_missing_super_argument_py_30.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_missing_super_argument_py_30.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -"""Check missing super argument for Python 2""" - -__revision__ = 0 - -class MyClass(object): - """ New style class """ - def __init__(self): - super().__init__() - \ No newline at end of file diff -Nru pylint-1.3.0/test/input/func___name___access.py pylint-1.3.1/test/input/func___name___access.py --- pylint-1.3.0/test/input/func___name___access.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func___name___access.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -# pylint: disable=R0903,W0142 -"""test access to __name__ gives undefined member on new/old class instances -but not on new/old class object -""" - -__revision__ = 1 - -class Aaaa: - """old class""" - def __init__(self): - print self.__name__ - print self.__class__.__name__ -class NewClass(object): - """new class""" - - def __new__(cls, *args, **kwargs): - print 'new', cls.__name__ - return object.__new__(cls, *args, **kwargs) - - def __init__(self): - print 'init', self.__name__ diff -Nru pylint-1.3.0/test/input/func_newstyle_exceptions.py pylint-1.3.1/test/input/func_newstyle_exceptions.py --- pylint-1.3.0/test/input/func_newstyle_exceptions.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_newstyle_exceptions.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,37 +0,0 @@ -# pylint: disable=C0103 -"""test pb with exceptions and old/new style classes""" - -__revision__ = 1 - -class OkException(Exception): - """bien bien bien""" - -class BofException: - """mouais""" - -class NewException(object): - """non si py < 2.5 !""" - -def fonctionOk(): - """raise""" - raise OkException('hop') - -def fonctionBof(): - """raise""" - raise BofException('hop') - -def fonctionNew(): - """raise""" - raise NewException() - -def fonctionBof2(): - """raise""" - raise BofException, 'hop' - -def fonctionNew2(): - """raise""" - raise NewException - -def fonctionNotImplemented(): - """raise""" - raise NotImplemented, 'hop' diff -Nru pylint-1.3.0/test/input/func_newstyle_property.py pylint-1.3.1/test/input/func_newstyle_property.py --- pylint-1.3.0/test/input/func_newstyle_property.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_newstyle_property.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,48 +0,0 @@ -# pylint: disable=R0903 -"""test property on old style class and property.setter/deleter usage""" - -__revision__ = 1 - -def getter(self): - """interesting""" - return self - -class OkOk(object): - """correct usage""" - method = property(getter, doc='hop') - -class HaNonNonNon: - """bad usage""" - method = property(getter, doc='hop') - - def __init__(self): - pass - -import logilab.common.decorators - -class SomeClass(object): - """another docstring""" - - def __init__(self): - self._prop = None - - @property - def prop(self): - """I'm the 'prop' property.""" - return self._prop - - @prop.setter - def prop(self, value): - """I'm the 'prop' property.""" - self._prop = value - - @prop.deleter - def prop(self): - """I'm the 'prop' property.""" - del self._prop - - # test regression - @logilab.common.decorators.cached - def noregr(self): - """used to crash in redefined_by_decorator""" - return self.prop diff -Nru pylint-1.3.0/test/input/func_newstyle_super.py pylint-1.3.1/test/input/func_newstyle_super.py --- pylint-1.3.0/test/input/func_newstyle_super.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_newstyle_super.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,47 +0,0 @@ -# pylint: disable=R0903,import-error -"""check use of super""" - -from unknown import Missing -__revision__ = None - -class Aaaa: - """old style""" - def hop(self): - """hop""" - super(Aaaa, self).hop() - - def __init__(self): - super(Aaaa, self).__init__() - -class NewAaaa(object): - """old style""" - def hop(self): - """hop""" - super(NewAaaa, self).hop() - - def __init__(self): - super(object, self).__init__() - -class Py3kAaaa(NewAaaa): - """new style""" - def __init__(self): - super().__init__() - -class Py3kWrongSuper(Py3kAaaa): - """new style""" - def __init__(self): - super(NewAaaa, self).__init__() - -class WrongNameRegression(Py3kAaaa): - """ test a regression with the message """ - def __init__(self): - super(Missing, self).__init__() - -class Getattr(object): - """ crash """ - name = NewAaaa - -class CrashSuper(object): - """ test a crash with this checker """ - def __init__(self): - super(Getattr.name, self).__init__() diff -Nru pylint-1.3.0/test/input/func_noerror_all_no_inference.py pylint-1.3.1/test/input/func_noerror_all_no_inference.py --- pylint-1.3.0/test/input/func_noerror_all_no_inference.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_noerror_all_no_inference.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -"""Test that non-inferable __all__ variables do not make Pylint crash. - -""" -# pylint: disable=R0903,R0201,W0612 - -__revision__ = 0 - -__all__ = sorted([ - 'Dummy', - 'NonExistant', - 'path', - 'func', - 'inner', - 'InnerKlass']) diff -Nru pylint-1.3.0/test/input/func_scope_regrtest.py pylint-1.3.1/test/input/func_scope_regrtest.py --- pylint-1.3.0/test/input/func_scope_regrtest.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_scope_regrtest.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -# pylint: disable=R0903,W0232 -"""check for scope problems""" - -__revision__ = None - -class Well(object): - """well""" - class Data(object): - """base hidden class""" - class Sub(Data): - """whaou, is Data found???""" - attr = Data() - def func(self): - """check Sub is not defined here""" - return Sub(), self diff -Nru pylint-1.3.0/test/input/func_string_format_py27.py pylint-1.3.1/test/input/func_string_format_py27.py --- pylint-1.3.0/test/input/func_string_format_py27.py 2014-07-26 07:44:30.000000000 +0100 +++ pylint-1.3.1/test/input/func_string_format_py27.py 2014-08-24 21:58:08.000000000 +0100 @@ -76,3 +76,13 @@ print "{a[0]}".format(a=object) print log("{}".format(2, "info")) print "{0.missing}".format(2) + print "{0} {1} {2}".format(1, 2) + print "{0} {1}".format(1, 2, 3) + +def good_issue288(*args, **kwargs): + """ Test that using kwargs does not emit a false + positive. + """ + data = 'Hello John Doe {0[0]}'.format(args) + print data + return 'Hello {0[name]}'.format(kwargs) diff -Nru pylint-1.3.0/test/messages/func_all.txt pylint-1.3.1/test/messages/func_all.txt --- pylint-1.3.0/test/messages/func_all.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_all.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -E: 18: Undefined variable name 'NonExistant' in __all__ -E: 20: Undefined variable name 'func' in __all__ -E: 21: Undefined variable name 'inner' in __all__ -E: 22: Undefined variable name 'InnerKlass' in __all__ diff -Nru pylint-1.3.0/test/messages/func_all_undefined.txt pylint-1.3.1/test/messages/func_all_undefined.txt --- pylint-1.3.0/test/messages/func_all_undefined.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_all_undefined.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -E: 8: Undefined variable 'SomeUndefinedName' diff -Nru pylint-1.3.0/test/messages/func_arguments.txt pylint-1.3.1/test/messages/func_arguments.txt --- pylint-1.3.0/test/messages/func_arguments.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_arguments.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,20 +0,0 @@ -E: 46: No value for argument 'first_argument' in function call -E: 47: Too many positional arguments for function call -E: 49: No value for argument 'third_argument' in function call -E: 50: No value for argument 'first_argument' in function call -E: 50: No value for argument 'second_argument' in function call -E: 50: No value for argument 'third_argument' in function call -E: 52: Too many positional arguments for function call -E: 59: No value for argument 'first_argument' in function call -E: 59: Unexpected keyword argument 'bob' in function call -E: 60: Unexpected keyword argument 'coin' in function call -E: 62: Argument 'one' passed by position and keyword in function call -E: 67: No value for argument 'arg' in lambda call -E: 72:method_tests: No value for argument 'arg' in staticmethod call -E: 73:method_tests: No value for argument 'arg' in staticmethod call -E: 75:method_tests: No value for argument 'arg' in classmethod call -E: 76:method_tests: No value for argument 'arg' in classmethod call -E: 78:method_tests: No value for argument 'arg' in method call -E: 79:method_tests: No value for argument 'arg' in unbound method call -E: 81:method_tests: No value for argument 'arg' in method call -E: 82:method_tests: No value for argument 'arg' in unbound method call diff -Nru pylint-1.3.0/test/messages/func_class_access_protected_members.txt pylint-1.3.1/test/messages/func_class_access_protected_members.txt --- pylint-1.3.0/test/messages/func_class_access_protected_members.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_class_access_protected_members.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -W: 17:MyClass.test: Access to a protected member _haha of a client class -W: 32: Access to a protected member _protected of a client class -W: 33: Access to a protected member _protected of a client class -W: 34: Access to a protected member _cls_protected of a client class -W: 35: Access to a protected member _cls_protected of a client class \ No newline at end of file diff -Nru pylint-1.3.0/test/messages/func_dict_keys.txt pylint-1.3.1/test/messages/func_dict_keys.txt --- pylint-1.3.0/test/messages/func_dict_keys.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_dict_keys.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -W: 10: Duplicate key 'tea' in dictionary diff -Nru pylint-1.3.0/test/messages/func_exceptions_raise_type_error.txt pylint-1.3.1/test/messages/func_exceptions_raise_type_error.txt --- pylint-1.3.0/test/messages/func_exceptions_raise_type_error.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_exceptions_raise_type_error.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -E: 11: Raising int while only classes, instances or string are allowed -E: 14: Raising NoneType while only classes, instances or string are allowed diff -Nru pylint-1.3.0/test/messages/func_globals.txt pylint-1.3.1/test/messages/func_globals.txt --- pylint-1.3.0/test/messages/func_globals.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_globals.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -E: 27: Undefined variable 'CSTE' -E: 32:other: Undefined variable 'HOP' -W: 23:fix_contant: Using the global statement -W: 26: Using the global statement at the module level -W: 31:other: Using global for 'HOP' but no assignment is done -W: 39:define_constant: Global variable 'SOMEVAR' undefined at the module level diff -Nru pylint-1.3.0/test/messages/func_missing_super_argument_py_30.txt pylint-1.3.1/test/messages/func_missing_super_argument_py_30.txt --- pylint-1.3.0/test/messages/func_missing_super_argument_py_30.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_missing_super_argument_py_30.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -E: 8:MyClass.__init__: Missing argument to super() -R: 5:MyClass: Too few public methods (0/2) diff -Nru pylint-1.3.0/test/messages/func___name___access_py30.txt pylint-1.3.1/test/messages/func___name___access_py30.txt --- pylint-1.3.0/test/messages/func___name___access_py30.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func___name___access_py30.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -E: 11:Aaaa.__init__: Instance of 'Aaaa' has no '__name__' member -E: 21:NewClass.__init__: Instance of 'NewClass' has no '__name__' member - diff -Nru pylint-1.3.0/test/messages/func___name___access.txt pylint-1.3.1/test/messages/func___name___access.txt --- pylint-1.3.0/test/messages/func___name___access.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func___name___access.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -C: 8:Aaaa: Old-style class defined. -E: 11:Aaaa.__init__: Instance of 'Aaaa' has no '__name__' member -E: 21:NewClass.__init__: Instance of 'NewClass' has no '__name__' member - diff -Nru pylint-1.3.0/test/messages/func_newstyle_exceptions_py30.txt pylint-1.3.1/test/messages/func_newstyle_exceptions_py30.txt --- pylint-1.3.0/test/messages/func_newstyle_exceptions_py30.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_newstyle_exceptions_py30.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -E: 21:fonctionBof: Raising a new style class which doesn't inherit from BaseException -E: 25:fonctionNew: Raising a new style class which doesn't inherit from BaseException -E: 29:fonctionBof2: Raising a new style class which doesn't inherit from BaseException -E: 33:fonctionNew2: Raising a new style class which doesn't inherit from BaseException -E: 37:fonctionNotImplemented: NotImplemented raised - should raise NotImplementedError diff -Nru pylint-1.3.0/test/messages/func_newstyle_exceptions.txt pylint-1.3.1/test/messages/func_newstyle_exceptions.txt --- pylint-1.3.0/test/messages/func_newstyle_exceptions.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_newstyle_exceptions.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -E: 25:fonctionNew: Raising a new style class which doesn't inherit from BaseException -E: 33:fonctionNew2: Raising a new style class which doesn't inherit from BaseException -E: 37:fonctionNotImplemented: NotImplemented raised - should raise NotImplementedError -W: 21:fonctionBof: Exception doesn't inherit from standard "Exception" class -W: 29:fonctionBof2: Exception doesn't inherit from standard "Exception" class -W: 29:fonctionBof2: Use raise ErrorClass(args) instead of raise ErrorClass, args. -W: 37:fonctionNotImplemented: Use raise ErrorClass(args) instead of raise ErrorClass, args. diff -Nru pylint-1.3.0/test/messages/func_newstyle_property.txt pylint-1.3.1/test/messages/func_newstyle_property.txt --- pylint-1.3.0/test/messages/func_newstyle_property.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_newstyle_property.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -C: 14:HaNonNonNon: Old-style class defined. -W: 16:HaNonNonNon: Use of "property" on an old style class diff -Nru pylint-1.3.0/test/messages/func_newstyle_super_py30.txt pylint-1.3.1/test/messages/func_newstyle_super_py30.txt --- pylint-1.3.0/test/messages/func_newstyle_super_py30.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_newstyle_super_py30.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -E: 23:NewAaaa.__init__: Bad first argument 'object' given to super() -E: 33:Py3kWrongSuper.__init__: Bad first argument 'NewAaaa' given to super() -E: 38:WrongNameRegression.__init__: Bad first argument 'Missing' given to super() -E: 47:CrashSuper.__init__: Bad first argument 'NewAaaa' given to super() \ No newline at end of file diff -Nru pylint-1.3.0/test/messages/func_newstyle_super.txt pylint-1.3.1/test/messages/func_newstyle_super.txt --- pylint-1.3.0/test/messages/func_newstyle_super.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_newstyle_super.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -C: 7:Aaaa: Old-style class defined. -E: 9:Aaaa.hop: Use of super on an old style class -E: 13:Aaaa.__init__: Use of super on an old style class -E: 23:NewAaaa.__init__: Bad first argument 'object' given to super() -E: 28:Py3kAaaa.__init__: Missing argument to super() -E: 33:Py3kWrongSuper.__init__: Bad first argument 'NewAaaa' given to super() -E: 38:WrongNameRegression.__init__: Bad first argument 'Missing' given to super() -E: 47:CrashSuper.__init__: Bad first argument 'NewAaaa' given to super() \ No newline at end of file diff -Nru pylint-1.3.0/test/messages/func_scope_regrtest.txt pylint-1.3.1/test/messages/func_scope_regrtest.txt --- pylint-1.3.0/test/messages/func_scope_regrtest.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_scope_regrtest.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -E: 12:Well.Sub: Undefined variable 'Data' -E: 15:Well.func: Undefined variable 'Sub' diff -Nru pylint-1.3.0/test/messages/func_string_format_py27.txt pylint-1.3.1/test/messages/func_string_format_py27.txt --- pylint-1.3.0/test/messages/func_string_format_py27.txt 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/messages/func_string_format_py27.txt 2014-08-24 21:58:08.000000000 +0100 @@ -3,6 +3,8 @@ E: 65:pprint_bad: Too many arguments for format string E: 67:pprint_bad: Not enough arguments for format string E: 77:pprint_bad: Too many arguments for format string +E: 79:pprint_bad: Not enough arguments for format string +E: 80:pprint_bad: Too many arguments for format string W: 59:pprint_bad: Invalid format string W: 60:pprint_bad: Invalid format string W: 61:pprint_bad: Format string contains both automatic field numbering and manual field specification diff -Nru pylint-1.3.0/test/regrtest_data/pygtk_enum_crash.py pylint-1.3.1/test/regrtest_data/pygtk_enum_crash.py --- pylint-1.3.0/test/regrtest_data/pygtk_enum_crash.py 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/regrtest_data/pygtk_enum_crash.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,11 +0,0 @@ -# pylint: disable=C0121 -"""http://www.logilab.org/ticket/124337""" - -import gtk - -def print_some_constant(arg=gtk.BUTTONS_OK): - """crash because gtk.BUTTONS_OK, a gtk enum type, is returned by - astroid as a constant - """ - print arg - diff -Nru pylint-1.3.0/test/regrtest_data/pygtk_import.py pylint-1.3.1/test/regrtest_data/pygtk_import.py --- pylint-1.3.0/test/regrtest_data/pygtk_import.py 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/regrtest_data/pygtk_import.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -#pylint: disable=R0903,R0904 -"""#10026""" -__revision__ = 1 -from gtk import VBox -import gtk - -class FooButton(gtk.Button): - """extend gtk.Button""" - def extend(self): - """hop""" - print self - -print gtk.Button -print VBox diff -Nru pylint-1.3.0/test/regrtest_data/socketerror_import.py pylint-1.3.1/test/regrtest_data/socketerror_import.py --- pylint-1.3.0/test/regrtest_data/socketerror_import.py 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/regrtest_data/socketerror_import.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -"""ds""" - -__revision__ = '$Id: socketerror_import.py,v 1.2 2005-12-28 14:58:22 syt Exp $' - -from socket import error -print error diff -Nru pylint-1.3.0/test/test_func.py pylint-1.3.1/test/test_func.py --- pylint-1.3.0/test/test_func.py 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/test_func.py 2014-08-24 21:58:08.000000000 +0100 @@ -45,7 +45,9 @@ class TestTests(testlib.TestCase): """check that all testable messages have been checked""" PORTED = set(['I0001', 'I0010', 'W0712', 'E1001', 'W1402', 'E1310', 'E0202', - 'W0711', 'W0108', 'C0112']) + 'W0711', 'W0108', 'E0603', 'W0710', 'E0710', 'E0711', 'W1001', + 'E1124', 'E1120', 'E1121', 'E1123', 'E1003', 'E1002', 'W0212', + 'W0109', 'E1004', 'W0604', 'W0601', 'W0602', 'C0112', 'C0330']) @testlib.tag('coverage') def test_exhaustivity(self): @@ -73,10 +75,7 @@ callbacks = [cb_test_gen(LintTestUpdate)] else: callbacks = [cb_test_gen(LintTestUsingModule)] - if not MODULES_ONLY: - callbacks.append(cb_test_gen(LintTestUsingFile)) tests = make_tests(INPUT_DIR, MSG_DIR, filter_rgx, callbacks) - if UPDATE: return tests @@ -94,12 +93,12 @@ # test all features are tested :) tests.append(TestTests) + assert len(tests) < 196, "Please do not add new test cases here." return tests # Create suite FILTER_RGX = None -MODULES_ONLY = False UPDATE = False def suite(): @@ -108,10 +107,6 @@ if __name__=='__main__': - if '-m' in sys.argv: - MODULES_ONLY = True - sys.argv.remove('-m') - if '-u' in sys.argv: UPDATE = True sys.argv.remove('-u') diff -Nru pylint-1.3.0/test/test_functional.py pylint-1.3.1/test/test_functional.py --- pylint-1.3.0/test/test_functional.py 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/test_functional.py 2014-08-24 21:58:08.000000000 +0100 @@ -1,6 +1,7 @@ """Functional full-module tests for PyLint.""" from __future__ import with_statement import ConfigParser +import contextlib import cStringIO import operator import os @@ -16,6 +17,10 @@ class NoFileError(Exception): pass +# TODOs +# - use a namedtuple for expected lines +# - implement exhaustivity tests +# - call skipTests in setUp when not using logilab.testlib any more. # If message files should be updated instead of checked. UPDATE = False @@ -54,6 +59,7 @@ _CONVERTERS = { 'min_pyver': parse_python_version, 'max_pyver': parse_python_version, + 'requires': lambda s: s.split(',') } @@ -63,6 +69,7 @@ self.options = { 'min_pyver': (2, 5), 'max_pyver': (4, 0), + 'requires': [] } self._parse_options() @@ -80,7 +87,7 @@ @property def option_file(self): - return self._file_type('.args') + return self._file_type('.rc') @property def module(self): @@ -110,6 +117,19 @@ '<=': operator.le, } +def parse_expected_output(stream): + lines = [] + for line in stream: + parts = line.split(':', 3) + if len(parts) != 4: + symbol, lineno, obj, msg = lines.pop() + lines.append((symbol, lineno, obj, msg + line)) + else: + linenum = int(parts[1]) + lines.append((parts[0], linenum, parts[2], parts[3])) + return lines + + def get_expected_messages(stream): """Parses a file and get expected messages. @@ -180,46 +200,52 @@ pass self._test_file = test_file - def shortDescription(self): - return self._test_file.base + def check_test(self): + if (sys.version_info < self._test_file.options['min_pyver'] + or sys.version_info >= self._test_file.options['max_pyver']): + self.skipTest( + 'Test cannot run with Python %s.' % (sys.version.split(' ')[0],)) + missing = [] + for req in self._test_file.options['requires']: + try: + __import__(req) + except ImportError: + missing.append(req) + if missing: + self.skipTest('Requires %s to be present.' % (','.join(missing),)) + + def __str__(self): + return "%s (%s.%s)" % (self._test_file.base, self.__class__.__module__, + self.__class__.__name__) - def _produces_output(self): - return True + def _open_expected_file(self): + return open(self._test_file.expected_output, 'U') def _get_expected(self): with open(self._test_file.source) as fobj: - expected = get_expected_messages(fobj) + expected_msgs = get_expected_messages(fobj) - lines = [] - if self._produces_output() and expected: - with open(self._test_file.expected_output, 'U') as fobj: - used = True - for line in fobj: - parts = line.split(':', 2) - if len(parts) != 3 and used: - lines.append(line) - else: - linenum = int(parts[1]) - if (linenum, parts[0]) in expected: - used = True - lines.append(line) - else: - used = False - return expected, ''.join(lines) + if expected_msgs: + with self._open_expected_file() as fobj: + expected_output_lines = parse_expected_output(fobj) + else: + expected_output_lines = [] + return expected_msgs, expected_output_lines def _get_received(self): messages = self._linter.reporter.messages - messages.sort(key=lambda m: (m.line, m.C, m.msg)) - text_result = cStringIO.StringIO() - received = {} + messages.sort(key=lambda m: (m.line, m.symbol, m.msg)) + received_msgs = {} + received_output_lines = [] for msg in messages: - received.setdefault((msg.line, msg.symbol), 0) - received[msg.line, msg.symbol] += 1 - text_result.write(msg.format('{symbol}:{line}:{obj}:{msg}')) - text_result.write('\n') - return received, text_result.getvalue() + received_msgs.setdefault((msg.line, msg.symbol), 0) + received_msgs[msg.line, msg.symbol] += 1 + received_output_lines.append( + (msg.symbol, msg.line, msg.obj or '', msg.msg + '\n')) + return received_msgs, received_output_lines def runTest(self): + self.check_test() self._linter.check([self._test_file.module]) expected_messages, expected_text = self._get_expected() @@ -238,22 +264,40 @@ self.fail('\n'.join(msg)) self._check_output_text(expected_messages, expected_text, received_text) - def _check_output_text(self, expected_messages, expected_text, received_text): - self.assertMultiLineEqual(expected_text, received_text) + def _split_lines(self, expected_messages, lines): + emitted, omitted = [], [] + for msg in lines: + if (msg[1], msg[0]) in expected_messages: + emitted.append(msg) + else: + omitted.append(msg) + return emitted, omitted + + def _check_output_text(self, expected_messages, expected_lines, + received_lines): + self.assertSequenceEqual( + self._split_lines(expected_messages, expected_lines)[0], + received_lines) class LintModuleOutputUpdate(LintModuleTest): - def _produces_output(self): - return False - - def _check_output_text(self, expected_messages, expected_text, received_text): - if expected_messages: + def _open_expected_file(self): + try: + return super(LintModuleOutputUpdate, self)._open_expected_file() + except IOError: + return contextlib.closing(cStringIO.StringIO()) + + def _check_output_text(self, expected_messages, expected_lines, + received_lines): + if not expected_messages: + return + emitted, remaining = self._split_lines(expected_messages, expected_lines) + if emitted != received_lines: + remaining.extend(received_lines) + remaining.sort(key=lambda m: (m[1], m[0], m[3])) with open(self._test_file.expected_output, 'w') as fobj: - fobj.write(received_text) - - -def active_in_running_python_version(options): - return options['min_pyver'] < sys.version_info <= options['max_pyver'] + for line in remaining: + fobj.write('{0}:{1}:{2}:{3}'.format(*line)) def suite(): @@ -263,17 +307,13 @@ for fname in os.listdir(input_dir): if fname != '__init__.py' and fname.endswith('.py'): test_file = TestFile(input_dir, fname) - if active_in_running_python_version(test_file.options): - if UPDATE: - suite.addTest(LintModuleOutputUpdate(test_file)) - else: - suite.addTest(LintModuleTest(test_file)) + if UPDATE: + suite.addTest(LintModuleOutputUpdate(test_file)) + else: + suite.addTest(LintModuleTest(test_file)) return suite -# TODO(tmarek): Port exhaustivity test from test_func once all tests have been added. - - if __name__=='__main__': if '-u' in sys.argv: UPDATE = True diff -Nru pylint-1.3.0/test/test_regr.py pylint-1.3.1/test/test_regr.py --- pylint-1.3.0/test/test_regr.py 2014-07-26 07:44:32.000000000 +0100 +++ pylint-1.3.1/test/test_regr.py 2014-08-24 21:58:08.000000000 +0100 @@ -75,28 +75,6 @@ sys.path.pop(0) os.chdir(cwd) - def test_gtk_import(self): - try: - import gtk - except ImportError: - self.skipTest('test skipped: gtk is not available') - except RuntimeError: # RuntimeError when missing display - self.skipTest('no display, can\'t run this test') - linter.check(join(REGR_DATA, 'pygtk_import.py')) - got = linter.reporter.finalize().strip() - self.assertEqual(got, '') - - def test_gtk_enum_crash(self): - try: - import gtk - except ImportError: - self.skipTest('test skipped: gtk is not available') - except RuntimeError: # RuntimeError when missing display - self.skipTest('no display, can\'t run this test') - linter.check(join(REGR_DATA, 'pygtk_enum_crash.py')) - got = linter.reporter.finalize().strip() - self.assertEqual(got, '') - def test_numarray_inference(self): try: from numarray import random_array @@ -115,11 +93,6 @@ got = linter.reporter.finalize().strip() self.assertEqual(got, '') - def test_socketerror_import(self): - linter.check(join(REGR_DATA, 'socketerror_import.py')) - got = linter.reporter.finalize().strip() - self.assertEqual(got, '') - def test_class__doc__usage(self): linter.check(join(REGR_DATA, 'classdoc_usage.py')) got = linter.reporter.finalize().strip()