Hello community, here is the log from the commit of package python2-pylint for openSUSE:Factory checked in at 2019-08-07 13:54:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python2-pylint (Old) and /work/SRC/openSUSE:Factory/.python2-pylint.new.9556 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python2-pylint" Wed Aug 7 13:54:24 2019 rev:4 rq:720099 version:1.9.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python2-pylint/python2-pylint.changes 2018-12-07 14:34:24.331145180 +0100 +++ /work/SRC/openSUSE:Factory/.python2-pylint.new.9556/python2-pylint.changes 2019-08-07 13:54:26.516857471 +0200 @@ -1,0 +2,6 @@ +Wed Jul 31 18:33:41 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Updte to 1.9.5: + * various bugfixes all around + +------------------------------------------------------------------- Old: ---- pylint-1.9.2.tar.gz New: ---- pylint-1.9.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python2-pylint.spec ++++++ --- /var/tmp/diff_new_pack.HlDS0r/_old 2019-08-07 13:54:27.364857462 +0200 +++ /var/tmp/diff_new_pack.HlDS0r/_new 2019-08-07 13:54:27.368857462 +0200 @@ -1,7 +1,7 @@ # # spec file for package python2-pylint # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,7 +20,7 @@ %define skip_python3 1 %define oldpython python Name: python2-pylint -Version: 1.9.2 +Version: 1.9.5 Release: 0 Summary: Syntax and style checker for Python code License: GPL-2.0-or-later @@ -99,7 +99,7 @@ %check # bsddb fails and upstream dropped support for python2 with new releases -%python_expand PYTHONPATH="%{buildroot}%{$python_sitelib}" py.test-%{$python_bin_suffix} pylint/test/ -k 'not test_libmodule[bsddb]' +%pytest pylint/test/ -k 'not test_libmodule[bsddb]' %files %{python_files} %license COPYING ++++++ pylint-1.9.2.tar.gz -> pylint-1.9.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/ChangeLog new/pylint-1.9.5/ChangeLog --- old/pylint-1.9.2/ChangeLog 2018-06-06 17:11:18.000000000 +0200 +++ new/pylint-1.9.5/ChangeLog 2019-07-16 11:48:01.000000000 +0200 @@ -2,6 +2,71 @@ Pylint's ChangeLog ------------------ +What's New in Pylint 1.9.5? +========================= + +Release date: 2019-07-16 + + * Fix a false positive `invalid name` message when method or attribute name is longer then 30 characters. + + Close #2047 + + * Fix compatibility with changes to stdlib tokenizer. + + +What's New in Pylint 1.9.4? +=========================== + +Release date: 2018-12-27 + + * ``deprecated-method`` is correctly emitted for ``assertEquals`` and friends. + + Close #2226 + + * Fixed false positive when a numpy Attributes section follows a Parameters section + + Close #1867 + + * Add support for nupmydoc optional return value names. + + Close #2030 + + * Can specify a default docstring type for when the check cannot guess the type + + Close #1169 + + * Fix false-postive undefined-variable in nested lambda + + Close #760 + + +What's New in Pylint 1.9.3? +=========================== + +Release date: 2018-07-24 + + * `chain.from_iterable` no longer emits `dict-{}-not-iterating` when dealing with dict values and keys + + * Fix incorrect file path when file absolute path contains multiple ``path_strip_prefix`` strings. + + Close #1120 and #2280 + + + * `in` is considered iterating context for some of the Python 3 porting checkers + + Close #2186 + + * Add `--exit-zero` option for continuous integration scripts to more + easily call Pylint in environments that abort when a program returns a + non-zero (error) status code. + + Close #2042 + + * [].extend and similar builtin operations don't emit `dict-*-not-iterating` with the Python 3 porting checker + + Close #2187 + + What's New in Pylint 1.9.2? =========================== @@ -206,7 +271,7 @@ Close #1713 - * Fixing u'' string in superfluous-parens message + * Fixing u'' string in superfluous-parens message Close #1420 @@ -228,7 +293,7 @@ This may lead to args list getting modified if keyword argument's value is not provided in the function call assuming it will take default value provided in the definition. - + * The `invalid-name` check contains the name of the template that caused the failure Close #1176 @@ -280,7 +345,7 @@ * Added a new key-value pair in json output. The key is ``message-id`` and the value is the message id. Close #1512 - + * Added a new Python 3.0 check for raising a StopIteration inside a generator. The check about raising a StopIteration inside a generator is also valid if the exception raised inherit from StopIteration. @@ -349,7 +414,7 @@ Close #1681 * Fix ``line-too-long`` message deactivated by wrong disable directive. - The directive ``disable=fixme`` doesn't deactivate anymore the emission + The directive ``disable=fixme`` doesn't deactivate anymore the emission of ``line-too-long`` message for long commented lines. Close #1741 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/PKG-INFO new/pylint-1.9.5/PKG-INFO --- old/pylint-1.9.2/PKG-INFO 2018-06-06 17:35:57.000000000 +0200 +++ new/pylint-1.9.5/PKG-INFO 2019-07-16 11:50:28.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: pylint -Version: 1.9.2 +Version: 1.9.5 Summary: python code static checker Home-page: https://github.com/PyCQA/pylint Author: Python Code Quality Authority @@ -105,4 +105,4 @@ Classifier: Topic :: Software Development :: Debuggers Classifier: Topic :: Software Development :: Quality Assurance Classifier: Topic :: Software Development :: Testing -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <3.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/doc/user_guide/options.rst new/pylint-1.9.5/doc/user_guide/options.rst --- old/pylint-1.9.2/doc/user_guide/options.rst 2018-04-02 09:47:18.000000000 +0200 +++ new/pylint-1.9.5/doc/user_guide/options.rst 2019-07-16 11:48:01.000000000 +0200 @@ -113,7 +113,7 @@ .. option:: --inlinevar-rgx=<regex> Multiple naming styles for custom regular expressions -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Large code bases that have been worked on for multiple years often exhibit an evolution in style as well. In some cases, modules can be in the same package, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/__pkginfo__.py new/pylint-1.9.5/pylint/__pkginfo__.py --- old/pylint-1.9.2/pylint/__pkginfo__.py 2018-06-06 17:11:06.000000000 +0200 +++ new/pylint-1.9.5/pylint/__pkginfo__.py 2019-07-16 11:48:01.000000000 +0200 @@ -27,7 +27,7 @@ modname = distname = 'pylint' -numversion = (1, 9, 2) +numversion = (1, 9, 5) version = '.'.join([str(num) for num in numversion]) install_requires = [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/checkers/base.py new/pylint-1.9.5/pylint/checkers/base.py --- old/pylint-1.9.2/pylint/checkers/base.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/checkers/base.py 2019-07-16 11:48:01.000000000 +0200 @@ -84,8 +84,8 @@ MOD_NAME_RGX = re.compile('([a-z_][a-z0-9_]*)$') CONST_NAME_RGX = re.compile('(([a-z_][a-z0-9_]*)|(__.*__))$') COMP_VAR_RGX = re.compile('[a-z_][a-z0-9_]*$') - DEFAULT_NAME_RGX = re.compile('(([a-z_][a-z0-9_]{2,30})|(_[a-z0-9_]*)|(__[a-z][a-z0-9_]+__))$') - CLASS_ATTRIBUTE_RGX = re.compile(r'(([a-z_][a-z0-9_]{2,30}|(__.*__)))$') + DEFAULT_NAME_RGX = re.compile('(([a-z_][a-z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-z][a-z0-9_]+__))$') + CLASS_ATTRIBUTE_RGX = re.compile(r'(([a-z_][a-z0-9_]{2,}|(__.*__)))$') class CamelCaseStyle(NamingStyle): @@ -93,8 +93,8 @@ MOD_NAME_RGX = re.compile('([a-z_][a-zA-Z0-9]*)$') CONST_NAME_RGX = re.compile('(([a-z_][A-Za-z0-9]*)|(__.*__))$') COMP_VAR_RGX = re.compile('[a-z_][A-Za-z0-9]*$') - DEFAULT_NAME_RGX = re.compile('(([a-z_][a-zA-Z0-9]{2,30})|(__[a-z][a-zA-Z0-9_]+__))$') - CLASS_ATTRIBUTE_RGX = re.compile(r'([a-z_][A-Za-z0-9]{2,30}|(__.*__))$') + DEFAULT_NAME_RGX = re.compile('(([a-z_][a-zA-Z0-9]{2,})|(__[a-z][a-zA-Z0-9_]+__))$') + CLASS_ATTRIBUTE_RGX = re.compile(r'([a-z_][A-Za-z0-9]{2,}|(__.*__))$') class PascalCaseStyle(NamingStyle): @@ -102,8 +102,8 @@ MOD_NAME_RGX = re.compile('[A-Z_][a-zA-Z0-9]+$') CONST_NAME_RGX = re.compile('(([A-Z_][A-Za-z0-9]*)|(__.*__))$') COMP_VAR_RGX = re.compile('[A-Z_][a-zA-Z0-9]+$') - DEFAULT_NAME_RGX = re.compile('[A-Z_][a-zA-Z0-9]{2,30}$|(__[a-z][a-zA-Z0-9_]+__)$') - CLASS_ATTRIBUTE_RGX = re.compile('[A-Z_][a-zA-Z0-9]{2,30}$') + DEFAULT_NAME_RGX = re.compile('[A-Z_][a-zA-Z0-9]{2,}$|(__[a-z][a-zA-Z0-9_]+__)$') + CLASS_ATTRIBUTE_RGX = re.compile('[A-Z_][a-zA-Z0-9]{2,}$') class UpperCaseStyle(NamingStyle): @@ -111,8 +111,8 @@ MOD_NAME_RGX = re.compile('[A-Z_][A-Z0-9_]+$') CONST_NAME_RGX = re.compile('(([A-Z_][A-Z0-9_]*)|(__.*__))$') COMP_VAR_RGX = re.compile('[A-Z_][A-Z0-9_]+$') - DEFAULT_NAME_RGX = re.compile('([A-Z_][A-Z0-9_]{2,30})|(__[a-z][a-zA-Z0-9_]+__)$') - CLASS_ATTRIBUTE_RGX = re.compile('[A-Z_][A-Z0-9_]{2,30}$') + DEFAULT_NAME_RGX = re.compile('([A-Z_][A-Z0-9_]{2,})|(__[a-z][a-zA-Z0-9_]+__)$') + CLASS_ATTRIBUTE_RGX = re.compile('[A-Z_][A-Z0-9_]{2,}$') class AnyStyle(NamingStyle): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/checkers/format.py new/pylint-1.9.5/pylint/checkers/format.py --- old/pylint-1.9.2/pylint/checkers/format.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/checkers/format.py 2019-07-16 11:48:01.000000000 +0200 @@ -871,8 +871,11 @@ def _check_line_ending(self, line_ending, line_num): # check if line endings are mixed if self._last_line_ending is not None: - if line_ending != self._last_line_ending: - self.add_message('mixed-line-endings', line=line_num) + # line_ending == "" indicates a synthetic newline added at + # the end of a file that does not, in fact, end with a + # newline. + if line_ending and line_ending != self._last_line_ending: + self.add_message("mixed-line-endings", line=line_num) self._last_line_ending = line_ending diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/checkers/python3.py new/pylint-1.9.5/pylint/checkers/python3.py --- old/pylint-1.9.2/pylint/checkers/python3.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/checkers/python3.py 2019-07-16 11:48:01.000000000 +0200 @@ -78,7 +78,17 @@ _ACCEPTS_ITERATOR = {'iter', 'list', 'tuple', 'sorted', 'set', 'sum', 'any', - 'all', 'enumerate', 'dict', 'filter', 'reversed'} + 'all', 'enumerate', 'dict', 'filter', 'reversed', + 'max', 'min', 'frozenset'} +ATTRIBUTES_ACCEPTS_ITERATOR = {'join', 'from_iterable'} +_BUILTIN_METHOD_ACCEPTS_ITERATOR = { + 'builtins.list.extend', + 'builtins.dict.update', + 'builtins.set.update', + '__builtin__.list.extend', + '__builtin__.dict.update', + '__builtin__.set.update', +} DICT_METHODS = {'items', 'keys', 'values'} @@ -106,14 +116,27 @@ if _is_builtin(parent_scope) and parent.func.name in _ACCEPTS_ITERATOR: return True elif isinstance(parent.func, astroid.Attribute): - if parent.func.attrname == 'join': + if parent.func.attrname in ATTRIBUTES_ACCEPTS_ITERATOR: return True + try: + inferred = next(parent.func.infer()) + except astroid.InferenceError: + pass + else: + if inferred is not astroid.Uninferable: + if inferred.qname() in _BUILTIN_METHOD_ACCEPTS_ITERATOR: + return True # If the call is in an unpacking, there's no need to warn, # since it can be considered iterating. elif (isinstance(parent, astroid.Assign) and isinstance(parent.targets[0], (astroid.List, astroid.Tuple))): if len(parent.targets[0].elts) > 1: return True + # If the call is in a containment check, we consider that to + # be an iterating context + elif (isinstance(parent, astroid.Compare) + and len(parent.ops) == 1 and parent.ops[0][0] == 'in'): + return True return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/checkers/stdlib.py new/pylint-1.9.5/pylint/checkers/stdlib.py --- old/pylint-1.9.2/pylint/checkers/stdlib.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/checkers/stdlib.py 2019-07-16 11:48:01.000000000 +0200 @@ -132,6 +132,13 @@ 'distutils.command.sdist.sdist.check_metadata', 'tkinter.Misc.tk_menuBar', 'tkinter.Menu.tk_bindForTraversal', + + # These are aliases for `assertEqual` et al. + 'assertEquals', + 'assertNotEquals', + 'assertAlmostEquals', + 'assertNotAlmostEquals', + 'assert_', ], 2: { (2, 6, 0): [ @@ -270,7 +277,7 @@ return qname = inferred.qname() - if qname in self.deprecated[0]: + if any(name in self.deprecated[0] for name in (qname, func_name)): self.add_message('deprecated-method', node=node, args=(func_name, )) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/checkers/utils.py new/pylint-1.9.5/pylint/checkers/utils.py --- old/pylint-1.9.2/pylint/checkers/utils.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/checkers/utils.py 2019-07-16 11:48:01.000000000 +0200 @@ -239,7 +239,6 @@ return True if getattr(_node, 'name', None) == varname: return True - break elif isinstance(_node, astroid.ExceptHandler): if isinstance(_node.name, astroid.AssignName): ass_node = _node.name diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/extensions/_check_docs_utils.py new/pylint-1.9.5/pylint/extensions/_check_docs_utils.py --- old/pylint-1.9.2/pylint/extensions/_check_docs_utils.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/extensions/_check_docs_utils.py 2019-07-16 11:48:01.000000000 +0200 @@ -145,14 +145,15 @@ return set() -def docstringify(docstring): +def docstringify(docstring, default_type='default'): for docstring_type in [SphinxDocstring, EpytextDocstring, GoogleDocstring, NumpyDocstring]: instance = docstring_type(docstring) if instance.is_valid(): return instance - return Docstring(docstring) + docstring_type = DOCSTRING_TYPES.get(default_type, Docstring) + return docstring_type(docstring) class Docstring(object): @@ -428,6 +429,7 @@ \s* \*{{0,2}}(\w+) # identifier potentially with asterisks \s* ( [(] {type} + (?:,\s+optional)? [)] )? \s* : # optional type declaration \s* (.*) # beginning of optional description """.format( @@ -609,6 +611,12 @@ def min_section_indent(section_match): return len(section_match.group(1)) + 1 + @staticmethod + def _is_section_header(_): + # Google parsing does not need to detect section headers, + # because it works off of indentation level only + return False + def _parse_section(self, section_re): section_match = section_re.search(self.doc) if section_match is None: @@ -633,6 +641,8 @@ is_first = False if indentation == min_indentation: + if self._is_section_header(line): + break # Lines with minimum indentation must contain the beginning # of a new parameter documentation. if entry: @@ -685,8 +695,9 @@ ) re_returns_line = re.compile(r""" - \s* ({type})$ # type declaration - \s* (.*) # optional description + \s* (?:\w+\s+:\s+)? # optional name + ({type})$ # type declaration + \s* (.*) # optional description """.format( type=GoogleDocstring.re_multiple_type, ), re.X | re.S | re.M) @@ -703,3 +714,20 @@ @staticmethod def min_section_indent(section_match): return len(section_match.group(1)) + + @staticmethod + def _is_section_header(line): + return bool(re.match(r'\s*-+$', line)) + + +DOCSTRING_TYPES = { + 'sphinx': SphinxDocstring, + 'epytext': EpytextDocstring, + 'google': GoogleDocstring, + 'numpy': NumpyDocstring, + 'default': Docstring, +} +"""A map of the name of the docstring type to its class. + +:type: dict(str, type) +""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/extensions/docparams.py new/pylint-1.9.5/pylint/extensions/docparams.py --- old/pylint-1.9.2/pylint/extensions/docparams.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/extensions/docparams.py 2019-07-16 11:48:01.000000000 +0200 @@ -123,6 +123,12 @@ 'help': 'Whether to accept totally missing yields ' 'documentation in the docstring of a generator.' }), + ('default-docstring-type', + {'type': 'choice', 'default': 'default', + 'choices': list(utils.DOCSTRING_TYPES), + 'help': 'If the docstring type cannot be guessed ' + 'the specified docstring type will be used.' + }), ) priority = -2 @@ -136,7 +142,9 @@ :param node: Node for a function or method definition in the AST :type node: :class:`astroid.scoped_nodes.Function` """ - node_doc = utils.docstringify(node.doc) + node_doc = utils.docstringify( + node.doc, self.config.default_docstring_type, + ) self.check_functiondef_params(node, node_doc) self.check_functiondef_returns(node, node_doc) self.check_functiondef_yields(node, node_doc) @@ -146,7 +154,9 @@ if node.name in self.constructor_names: class_node = checker_utils.node_frame_class(node) if class_node is not None: - class_doc = utils.docstringify(class_node.doc) + class_doc = utils.docstringify( + class_node.doc, self.config.default_docstring_type, + ) self.check_single_constructor_params(class_doc, node_doc, class_node) # __init__ or class docstrings can have no parameters documented @@ -206,7 +216,9 @@ if property_: func_node = property_ - doc = utils.docstringify(func_node.doc) + doc = utils.docstringify( + func_node.doc, self.config.default_docstring_type, + ) if not doc.is_valid(): if doc.doc: self._handle_no_raise_doc(expected_excs, func_node) @@ -224,7 +236,9 @@ if not isinstance(func_node, astroid.FunctionDef): return - doc = utils.docstringify(func_node.doc) + doc = utils.docstringify( + func_node.doc, self.config.default_docstring_type, + ) if not doc.is_valid() and self.config.accept_no_return_doc: return @@ -249,7 +263,9 @@ if not isinstance(func_node, astroid.FunctionDef): return - doc = utils.docstringify(func_node.doc) + doc = utils.docstringify( + func_node.doc, self.config.default_docstring_type, + ) if not doc.is_valid() and self.config.accept_no_yields_doc: return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/lint.py new/pylint-1.9.5/pylint/lint.py --- old/pylint-1.9.2/pylint/lint.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/lint.py 2019-07-16 11:48:01.000000000 +0200 @@ -417,6 +417,12 @@ 'help': ('When enabled, pylint would attempt to guess common ' 'misconfiguration and emit user-friendly hints instead ' 'of false-positive error messages')}), + + ('exit-zero', + {'action': 'store_true', + 'help': ('Always return a 0 (non-error) status code, even if ' + 'lint errors are found. This is primarily useful in ' + 'continuous integration scripts.')}), ) option_groups = ( @@ -1347,7 +1353,10 @@ linter.check(args) linter.generate_reports() if exit: - sys.exit(self.linter.msg_status) + if linter.config.exit_zero: + sys.exit(0) + else: + sys.exit(self.linter.msg_status) def cb_set_rcfile(self, name, value): """callback for option preprocessing (i.e. before option parsing)""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/extensions/test_check_docs.py new/pylint-1.9.5/pylint/test/extensions/test_check_docs.py --- old/pylint-1.9.2/pylint/test/extensions/test_check_docs.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/extensions/test_check_docs.py 2019-07-16 11:48:01.000000000 +0200 @@ -750,6 +750,29 @@ ): self._visit_methods_of_class(node) + def test_constr_params_and_attributes_in_class_numpy(self): + """Example of a class with correct constructor parameter documentation + and an attributes section (Numpy style) + """ + node = astroid.extract_node(""" + class ClassFoo(object): + ''' + Parameters + ---------- + foo : str + Something. + + Attributes + ---------- + bar : str + Something. + ''' + def __init__(self, foo): + self.bar = None + """) + with self.assertNoMessages(): + self._visit_methods_of_class(node) + def test_constr_params_in_init_sphinx(self): """Example of a class with missing constructor parameter documentation (Sphinx style) @@ -1441,6 +1464,27 @@ with self.assertNoMessages(): self.checker.visit_functiondef(node) + def test_ignores_optional_specifier_google(self): + node = astroid.extract_node(''' + def do_something(param1, param2, param3=(), param4=[], param5=[], param6=True): + """Do something. + + Args: + param1 (str): Description. + param2 (dict(str, int)): Description. + param3 (tuple(str), optional): Defaults to empty. Description. + param4 (List[str], optional): Defaults to empty. Description. + param5 (list[tuple(str)], optional): Defaults to empty. Description. + param6 (bool, optional): Defaults to True. Description. + + Returns: + int: Description. + """ + return param1, param2, param3, param4, param5, param6 + ''') + with self.assertNoMessages(): + self.checker.visit_functiondef(node) + def test_ignores_optional_specifier_numpy(self): node = astroid.extract_node(''' def do_something(param, param2='all'): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/functional/deprecated_methods_py2.py new/pylint-1.9.5/pylint/test/functional/deprecated_methods_py2.py --- old/pylint-1.9.2/pylint/test/functional/deprecated_methods_py2.py 2018-01-25 15:58:17.000000000 +0100 +++ new/pylint-1.9.5/pylint/test/functional/deprecated_methods_py2.py 2019-07-16 11:48:01.000000000 +0200 @@ -1,9 +1,20 @@ """ Functional test for deprecated methods in Python 2 """ -# pylint: disable=no-member +# pylint: disable=no-member,missing-docstring import os import xml.etree.ElementTree +import unittest os.popen2('') # [deprecated-method] os.popen3('') # [deprecated-method] os.popen4('') # [deprecated-method] xml.etree.ElementTree.Element('elem').getchildren() # [deprecated-method] + + +class Tests(unittest.TestCase): + + def test_foo(self): + self.assertEquals(2 + 2, 4) # [deprecated-method] + self.assertNotEquals(2 + 2, 4) # [deprecated-method] + self.assertAlmostEquals(2 + 2, 4) # [deprecated-method] + self.assertNotAlmostEquals(2 + 2, 4) # [deprecated-method] + self.assert_("abc" == "2") # [deprecated-method] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/functional/deprecated_methods_py2.txt new/pylint-1.9.5/pylint/test/functional/deprecated_methods_py2.txt --- old/pylint-1.9.2/pylint/test/functional/deprecated_methods_py2.txt 2018-01-07 11:53:29.000000000 +0100 +++ new/pylint-1.9.5/pylint/test/functional/deprecated_methods_py2.txt 2019-07-16 11:48:01.000000000 +0200 @@ -1,4 +1,9 @@ -deprecated-method:6::Using deprecated method popen2() -deprecated-method:7::Using deprecated method popen3() -deprecated-method:8::Using deprecated method popen4() -deprecated-method:9::Using deprecated method getchildren() +deprecated-method:7::Using deprecated method popen2() +deprecated-method:8::Using deprecated method popen3() +deprecated-method:9::Using deprecated method popen4() +deprecated-method:10::Using deprecated method getchildren() +deprecated-method:16:Tests.test_foo:Using deprecated method assertEquals() +deprecated-method:17:Tests.test_foo:Using deprecated method assertNotEquals() +deprecated-method:18:Tests.test_foo:Using deprecated method assertAlmostEquals() +deprecated-method:19:Tests.test_foo:Using deprecated method assertNotAlmostEquals() +deprecated-method:20:Tests.test_foo:Using deprecated method assert_() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/functional/namePresetCamelCase.txt new/pylint-1.9.5/pylint/test/functional/namePresetCamelCase.txt --- old/pylint-1.9.2/pylint/test/functional/namePresetCamelCase.txt 2018-04-02 09:47:18.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/functional/namePresetCamelCase.txt 2019-07-16 11:48:01.000000000 +0200 @@ -1,3 +1,3 @@ invalid-name:3::"Constant name ""SOME_CONSTANT"" doesn't conform to camelCase naming style ('(([a-z_][A-Za-z0-9]*)|(__.*__))$' pattern)" invalid-name:10:MyClass:"Class name ""MyClass"" doesn't conform to camelCase naming style ('[a-z_][a-zA-Z0-9]+$' pattern)" -invalid-name:22:say_hello:"Function name ""say_hello"" doesn't conform to camelCase naming style ('(([a-z_][a-zA-Z0-9]{2,30})|(__[a-z][a-zA-Z0-9_]+__))$' pattern)" +invalid-name:22:say_hello:"Function name ""say_hello"" doesn't conform to camelCase naming style ('(([a-z_][a-zA-Z0-9]{2,})|(__[a-z][a-zA-Z0-9_]+__))$' pattern)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/functional/name_preset_snake_case.txt new/pylint-1.9.5/pylint/test/functional/name_preset_snake_case.txt --- old/pylint-1.9.2/pylint/test/functional/name_preset_snake_case.txt 2018-04-02 09:47:18.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/functional/name_preset_snake_case.txt 2019-07-16 11:48:01.000000000 +0200 @@ -1,3 +1,3 @@ invalid-name:3::"Constant name ""SOME_CONSTANT"" doesn't conform to snake_case naming style ('(([a-z_][a-z0-9_]*)|(__.*__))$' pattern)" invalid-name:10:MyClass:"Class name ""MyClass"" doesn't conform to snake_case naming style ('[a-z_][a-z0-9_]+$' pattern)" -invalid-name:22:sayHello:"Function name ""sayHello"" doesn't conform to snake_case naming style ('(([a-z_][a-z0-9_]{2,30})|(_[a-z0-9_]*)|(__[a-z][a-z0-9_]+__))$' pattern)" +invalid-name:22:sayHello:"Function name ""sayHello"" doesn't conform to snake_case naming style ('(([a-z_][a-z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-z][a-z0-9_]+__))$' pattern)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/functional/name_styles.py new/pylint-1.9.5/pylint/test/functional/name_styles.py --- old/pylint-1.9.2/pylint/test/functional/name_styles.py 2018-04-02 09:47:18.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/functional/name_styles.py 2019-07-16 11:48:01.000000000 +0200 @@ -129,10 +129,6 @@ return good_variable_name + good_arg_name -def too_long_function_name_in_public_scope(): # [invalid-name] - """Public scope function with a too long name""" - return 12 - def _private_scope_function_with_long_descriptive_name(): """Private scope function are cool with long descriptive names""" return 12 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/functional/name_styles.txt new/pylint-1.9.5/pylint/test/functional/name_styles.txt --- old/pylint-1.9.2/pylint/test/functional/name_styles.txt 2018-04-02 09:47:18.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/functional/name_styles.txt 2019-07-16 11:48:01.000000000 +0200 @@ -14,4 +14,3 @@ invalid-name:107:FooClass.PROPERTY_NAME:"Attribute name ""PROPERTY_NAME"" doesn't conform to snake_case naming style":INFERENCE invalid-name:112:FooClass.ABSTRACT_PROPERTY_NAME:"Attribute name ""ABSTRACT_PROPERTY_NAME"" doesn't conform to snake_case naming style":INFERENCE invalid-name:117:FooClass.PROPERTY_NAME_SETTER:"Attribute name ""PROPERTY_NAME_SETTER"" doesn't conform to snake_case naming style":INFERENCE -invalid-name:132:too_long_function_name_in_public_scope:"Function name ""too_long_function_name_in_public_scope"" doesn't conform to snake_case naming style" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/functional/unknown_encoding_pypy.py new/pylint-1.9.5/pylint/test/functional/unknown_encoding_pypy.py --- old/pylint-1.9.2/pylint/test/functional/unknown_encoding_pypy.py 2018-01-07 11:53:29.000000000 +0100 +++ new/pylint-1.9.5/pylint/test/functional/unknown_encoding_pypy.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -# +1: [syntax-error] -# -*- coding: IBO-8859-1 -*- -""" check correct unknown encoding declaration -""" - -__revision__ = 'יייי' - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/functional/unknown_encoding_pypy.rc new/pylint-1.9.5/pylint/test/functional/unknown_encoding_pypy.rc --- old/pylint-1.9.2/pylint/test/functional/unknown_encoding_pypy.rc 2018-04-02 09:47:18.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/functional/unknown_encoding_pypy.rc 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -[testoptions] -min_pyver=3.0 -except_implementations=CPython, IronPython \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/functional/unknown_encoding_pypy.txt new/pylint-1.9.5/pylint/test/functional/unknown_encoding_pypy.txt --- old/pylint-1.9.2/pylint/test/functional/unknown_encoding_pypy.txt 2018-01-07 11:53:29.000000000 +0100 +++ new/pylint-1.9.5/pylint/test/functional/unknown_encoding_pypy.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -syntax-error:1::"Unknown encoding: ibo-8859-1" \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/test_import_graph.py new/pylint-1.9.5/pylint/test/test_import_graph.py --- old/pylint-1.9.2/pylint/test/test_import_graph.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/test_import_graph.py 2019-07-16 11:48:01.000000000 +0200 @@ -62,7 +62,7 @@ pass [email protected]("remove_files") [email protected]("remove_files") def test_checker_dep_graphs(linter): l = linter l.global_set_option('persistent', False) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/test_regr.py new/pylint-1.9.5/pylint/test/test_regr.py --- old/pylint-1.9.2/pylint/test/test_regr.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/test_regr.py 2019-07-16 11:48:01.000000000 +0200 @@ -100,7 +100,7 @@ os.chdir(cwd) [email protected]("modify_path") [email protected]("modify_path") def test_check_package___init__(finalize_linter): filename = 'package.__init__' finalize_linter.check(filename) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/test_self.py new/pylint-1.9.5/pylint/test/test_self.py --- old/pylint-1.9.2/pylint/test/test_self.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/test_self.py 2019-07-16 11:48:01.000000000 +0200 @@ -19,16 +19,11 @@ import contextlib import json import re -import sys -import os from os.path import join, dirname, abspath import tempfile import textwrap -import six - from pylint.lint import Run -from pylint.reporters import BaseReporter from pylint.reporters.text import * from pylint.reporters.json import JSONReporter import pytest @@ -94,7 +89,7 @@ class TestRunTC(object): - def _runtest(self, args, reporter=None, out=None, code=28): + def _runtest(self, args, reporter=None, out=None, code=None): if out is None: out = six.StringIO() pylint_code = self._run_pylint(args, reporter=reporter, out=out) @@ -129,15 +124,14 @@ self._runtest(['pylint.__pkginfo__'], reporter=TextReporter(six.StringIO()), code=0) - def test_all(self): - """Make pylint check itself.""" + def test_all_reporters(self): reporters = [ TextReporter(six.StringIO()), ColorizedTextReporter(six.StringIO()), JSONReporter(six.StringIO()) ] - self._runtest(['pylint/test/functional/arguments.py'], - reporter=MultiReporter(reporters), code=1) + self._runtest([join(HERE, 'regrtest_data', 'syntax_error.py')], + reporter=MultiReporter(reporters), code=2) def test_no_ext_file(self): self._runtest([join(HERE, 'input', 'noext')], code=0) @@ -145,6 +139,12 @@ def test_w0704_ignored(self): self._runtest([join(HERE, 'input', 'ignore_except_pass_by_default.py')], code=0) + def test_exit_zero(self): + self._runtest([ + '--exit-zero', + join(HERE, 'regrtest_data', 'syntax_error.py') + ], code=0) + def test_generate_config_option(self): self._runtest(['--generate-rcfile'], code=0) @@ -211,8 +211,9 @@ out=strio, code=28) def test_parallel_execution(self): - self._runtest(['-j 2', 'pylint/test/functional/arguments.py', - 'pylint/test/functional/bad_continuation.py'], code=1) + self._runtest(['-j 2', + join(HERE, 'functional/arguments.py'), + join(HERE, 'functional/bad_continuation.py')], code=18) def test_parallel_execution_missing_arguments(self): self._runtest(['-j 2', 'not_here', 'not_here_too'], code=1) @@ -458,3 +459,23 @@ module = join(HERE, 'regrtest_data', 'application_crash.py') with _configure_lc_ctype('UTF-8'): self._test_output([module, '-E'], expected_output=expected_output) + + @pytest.mark.skipif(sys.platform == 'win32', reason='only occurs on *nix') + def test_parseable_file_path(self): + file_name = 'test_target.py' + fake_path = HERE + os.getcwd() + module = join(fake_path, file_name) + + try: + # create module under directories which have the same name as reporter.path_strip_prefix + # e.g. /src/some/path/src/test_target.py when reporter.path_strip_prefix = /src/ + os.makedirs(fake_path) + with open(module, 'w') as test_target: + test_target.write('a = object()') + + self._test_output( + [module, '--output-format=parseable'], + expected_output=join(os.getcwd(), file_name)) + finally: + os.remove(module) + os.removedirs(fake_path) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/unittest_checker_python3.py new/pylint-1.9.5/pylint/test/unittest_checker_python3.py --- old/pylint-1.9.2/pylint/test/unittest_checker_python3.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/unittest_checker_python3.py 2019-07-16 11:48:01.000000000 +0200 @@ -200,11 +200,22 @@ def test_dict_methods_in_iterating_context(self): iterating_code = [ - 'for x in {}: pass', - '(x for x in {})', - '[x for x in {}]', - 'func({})', - 'a, b = {}', + 'for x in {}(): pass', + '(x for x in {}())', + '[x for x in {}()]', + 'iter({}())', + 'a, b = {}()', + 'max({}())', + 'min({}())', + '3 in {}()', + 'set().update({}())', + '[].extend({}())', + '{{}}.update({}())', + ''' + from __future__ import absolute_import + from itertools import chain + chain.from_iterable({}()) + ''', ] non_iterating_code = [ 'x = __({}())', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/unittest_checker_variables.py new/pylint-1.9.5/pylint/test/unittest_checker_variables.py --- old/pylint-1.9.2/pylint/test/unittest_checker_variables.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/unittest_checker_variables.py 2019-07-16 11:48:01.000000000 +0200 @@ -180,6 +180,7 @@ with self.assertNoMessages(): self.walk(node) + def test_scope_in_defaults(self): # Should not emit undefined variable node = astroid.extract_node(''' @@ -200,6 +201,18 @@ ''') with self.assertNoMessages(): self.walk(node) + + def test_nested_lambda(self): + """Make sure variables from parent lambdas + aren't noted as undefined + + https://github.com/PyCQA/pylint/issues/760 + """ + node = astroid.parse(''' + lambda x: lambda: x + 1 + ''') + with self.assertNoMessages(): + self.walk(node) class TestMissingSubmodule(CheckerTestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/unittest_lint.py new/pylint-1.9.5/pylint/test/unittest_lint.py --- old/pylint-1.9.2/pylint/test/unittest_lint.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/unittest_lint.py 2019-07-16 11:48:01.000000000 +0200 @@ -532,7 +532,7 @@ os.environ.pop('PYLINTRC', None) [email protected]("pop_pylintrc") [email protected]("pop_pylintrc") def test_pylint_home(): uhome = os.path.expanduser('~') if uhome == '~': @@ -559,7 +559,7 @@ @pytest.mark.skipif(PYPY_VERSION_INFO, reason="TOX runs this test from within the repo and finds " "the project's pylintrc.") [email protected]("pop_pylintrc") [email protected]("pop_pylintrc") def test_pylintrc(): with fake_home(): current_dir = getcwd() @@ -576,7 +576,7 @@ reload_module(config) [email protected]("pop_pylintrc") [email protected]("pop_pylintrc") def test_pylintrc_parentdir(): with tempdir() as chroot: @@ -596,7 +596,7 @@ assert config.find_pylintrc() == expected [email protected]("pop_pylintrc") [email protected]("pop_pylintrc") def test_pylintrc_parentdir_no_package(): with tempdir() as chroot: with fake_home(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/test/unittest_reporting.py new/pylint-1.9.5/pylint/test/unittest_reporting.py --- old/pylint-1.9.2/pylint/test/unittest_reporting.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/test/unittest_reporting.py 2019-07-16 11:48:01.000000000 +0200 @@ -43,15 +43,6 @@ 'C0301:002\n' -def test_parseable_output_deprecated(): - with warnings.catch_warnings(record=True) as cm: - warnings.simplefilter("always") - ParseableTextReporter() - - assert len(cm) == 1 - assert isinstance(cm[0].message, DeprecationWarning) - - def test_parseable_output_regression(): output = six.StringIO() with warnings.catch_warnings(record=True): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint/utils.py new/pylint-1.9.5/pylint/utils.py --- old/pylint-1.9.2/pylint/utils.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/pylint/utils.py 2019-07-16 11:48:01.000000000 +0200 @@ -436,7 +436,7 @@ else: module, obj = get_module_and_frameid(node) abspath = node.root().file - path = abspath.replace(self.reporter.path_strip_prefix, '') + path = abspath.replace(self.reporter.path_strip_prefix, '', 1) # add the message self.reporter.handle_message( Message(msgid, symbol, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint.egg-info/PKG-INFO new/pylint-1.9.5/pylint.egg-info/PKG-INFO --- old/pylint-1.9.2/pylint.egg-info/PKG-INFO 2018-06-06 17:35:56.000000000 +0200 +++ new/pylint-1.9.5/pylint.egg-info/PKG-INFO 2019-07-16 11:50:27.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: pylint -Version: 1.9.2 +Version: 1.9.5 Summary: python code static checker Home-page: https://github.com/PyCQA/pylint Author: Python Code Quality Authority @@ -105,4 +105,4 @@ Classifier: Topic :: Software Development :: Debuggers Classifier: Topic :: Software Development :: Quality Assurance Classifier: Topic :: Software Development :: Testing -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <3.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/pylint.egg-info/SOURCES.txt new/pylint-1.9.5/pylint.egg-info/SOURCES.txt --- old/pylint-1.9.2/pylint.egg-info/SOURCES.txt 2018-06-06 17:35:56.000000000 +0200 +++ new/pylint-1.9.5/pylint.egg-info/SOURCES.txt 2019-07-16 11:50:27.000000000 +0200 @@ -741,9 +741,6 @@ pylint/test/functional/unknown_encoding_py29.py pylint/test/functional/unknown_encoding_py29.rc pylint/test/functional/unknown_encoding_py29.txt -pylint/test/functional/unknown_encoding_pypy.py -pylint/test/functional/unknown_encoding_pypy.rc -pylint/test/functional/unknown_encoding_pypy.txt pylint/test/functional/unnecessary_lambda.py pylint/test/functional/unnecessary_lambda.txt pylint/test/functional/unnecessary_pass.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-1.9.2/setup.py new/pylint-1.9.5/setup.py --- old/pylint-1.9.2/setup.py 2018-06-06 17:08:35.000000000 +0200 +++ new/pylint-1.9.5/setup.py 2019-07-16 11:48:01.000000000 +0200 @@ -169,7 +169,7 @@ cmdclass=cmdclass, extras_require=extras_require, test_suite='test', - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <3.7', setup_requires=['pytest-runner'], tests_require=['pytest'], **kwargs)
