diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4086d410b3..8c2390a727 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,6 +74,13 @@ repos: args: ["-rn", "-sn", "--rcfile=pylintrc", "--fail-on=I", "--spelling-dict=en"] exclude: tests/functional/|tests/input|tests(/\w*)*data/|doc/ stages: [manual] + - id: check-changelog + alias: check-changelog + name: check-changelog + types: [text] + entry: python3 script/check_changelog.py + pass_filenames: false + language: system - id: fix-documentation name: Fix documentation entry: python3 -m script.fix_documentation diff --git a/.pyenchant_pylint_custom_dict.txt b/.pyenchant_pylint_custom_dict.txt index 1f8705c703..b5d832d058 100644 --- a/.pyenchant_pylint_custom_dict.txt +++ b/.pyenchant_pylint_custom_dict.txt @@ -25,6 +25,7 @@ BaseChecker basename behaviour bidi +Bitbucket bla bom bool @@ -172,6 +173,7 @@ linkers linter linux listcomp +Logilab longstring lsp mapfile @@ -351,4 +353,5 @@ wc xfails xml xyz +yml yoda diff --git a/doc/development_guide/contributor_guide/tests/install.rst b/doc/development_guide/contributor_guide/tests/install.rst index 86dbb14636..c150d0b91b 100644 --- a/doc/development_guide/contributor_guide/tests/install.rst +++ b/doc/development_guide/contributor_guide/tests/install.rst @@ -25,7 +25,7 @@ This ensures your testing environment is similar to Pylint's testing environment **Optionally** (Because there's an auto-fix if you open a merge request): We have pre-commit hooks which should take care of the autoformatting for you before each -commits. To enable it, run ``pre-commit install`` in the ``pylint`` root directory. +commit. To enable it, run ``pre-commit install`` in the ``pylint`` root directory. Astroid installation -------------------- diff --git a/doc/whatsnew/0/0.x.rst b/doc/whatsnew/0/0.x.rst index 6bd9f37d97..68abe04767 100644 --- a/doc/whatsnew/0/0.x.rst +++ b/doc/whatsnew/0/0.x.rst @@ -658,7 +658,7 @@ Release date: 2006-08-10 * started a reference user manual * new W0212 message for access to protected member from client code - (close #14081) + (Closes #14081) * new W0105 and W0106 messages extracted from W0104 (statement seems to have no effect) respectively when the statement is actually string @@ -668,7 +668,7 @@ Release date: 2006-08-10 * reclassified W0302 to C0302 * fix so that global messages are not anymore connected to the last - analyzed module (close #10106) + analyzed module (Closes #10106) * fix some bugs related to local disabling of messages @@ -708,7 +708,7 @@ Release date: 2006-03-06 * W0705 has been reclassified to E0701, and is now detecting more inheriting problem, and a false positive when empty except clause is - following an Exception catch has been fixed (close #10422) + following an Exception catch has been fixed (Closes #10422) * E0212 and E0214 (metaclass/class method should have mcs/cls as first argument have been reclassified to C0202 and C0203 since this not as @@ -812,13 +812,13 @@ Release date: 2005-11-07 module whose name starts with a deprecated module's name (close #10061) -* fix "module has no name __dict__" false positive (close #10039) +* fix "module has no name __dict__" false positive (Closes #10039) * fix "access to undefined variable __path__" false positive (close #10065) * fix "explicit return in __init__" false positive when return is - actually in an inner function (close #10075) + actually in an inner function (Closes #10075) What's New in Pylint 0.8.0? @@ -835,7 +835,7 @@ Release date: 2005-10-21 * new --acquired-members option on the classes checker, used when --zope=yes to avoid false positive on acquired attributes (listed - using this new option) (close #8616) + using this new option) (Closes #8616) * generate one E0602 for each use of an undefined variable (previously, only one for the first use but not for the following) @@ -855,11 +855,11 @@ Release date: 2005-10-21 * fix astng checkers traversal order * fix bug in format checker when parsing a file from a platform - using different new line characters (close #9239) + using different new line characters (Closes #9239) * fix encoding detection regexp -* fix --rcfile handling (support for --rcfile=file, close #9590) +* fix --rcfile handling (support for --rcfile=file, Closes #9590) What's New in Pylint 0.7.0? @@ -896,11 +896,11 @@ Release date: 2005-04-14 * don't fail if we are unable to read an inline option (e.g. inside a module), just produce an information message (test func_i0010) -* new message E0103 for break or continue outside loop (close #8883, +* new message E0103 for break or continue outside loop (Closes #8883, test func_continue_not_in_loop) * fix bug in the variables checker, causing non detection of some - actual name error (close #8884, test + actual name error (Closes #8884, test func_nameerror_on_string_substitution) * fix bug in the classes checker which was making pylint crash if @@ -980,7 +980,7 @@ Release date: 2005-01-20 * correctly detect access to member defined latter in __init__ method * now depends on common 0.8.1 to fix problem with interface resolution - (close #8606) + (Closes #8606) * new --list-msgs option describing available checkers and their messages diff --git a/doc/whatsnew/1/1.2.rst b/doc/whatsnew/1/1.2.rst index 66bf97b93f..3b0a9a96a5 100644 --- a/doc/whatsnew/1/1.2.rst +++ b/doc/whatsnew/1/1.2.rst @@ -7,7 +7,7 @@ Release date: 2014-04-30 * Restore the ability to specify the init-hook option via the configuration file, which was accidentally broken in 1.2.0. -* Add a new warning [bad-continuation] for badly indentend continued +* Add a new warning [bad-continuation] for badly indented continued lines. * Emit [assignment-from-none] when the function contains bare returns. @@ -25,7 +25,8 @@ Release date: 2014-04-30 * Fix explicit checking of python script (1.2 regression, #219) * Restore --init-hook, renamed accidentally into --init-hooks in 1.2.0 - (#211) + + Closes #211 * Add 'indexing-exception' warning, which detects that indexing an exception occurs in Python 2 (behaviour removed in Python 3). @@ -73,7 +74,8 @@ Release date: 2014-04-18 configurable; contributed by morbo@google.com. * ensure init-hooks is evaluated before other options, notably load-plugins - (#166) + + Closes #166 * Python 2.5 support restored: fixed small issues preventing pylint to run on python 2.5. Bitbucket issues #50 and #62. @@ -83,9 +85,9 @@ Release date: 2014-04-18 assignments. * Add new warning, 'bad-reversed-sequence', for checking that the - reversed() builtin receive a sequence (implements __getitem__ and __len__, + reversed() builtin receive a sequence (implements ``__getitem__`` and ``__len__``, without being a dict or a dict subclass) or an instance which implements - __reversed__. + ``__reversed__``. * Mark ``file`` as a bad function when using python2 (closes #8). @@ -101,26 +103,35 @@ Release date: 2014-04-18 * Add a new warning 'abstract-class-instantiated' for checking that abstract classes created with ``abc`` module and - with abstract methods are instantied. + with abstract methods are instantiated. * Do not warn about 'return-arg-in-generator' in Python 3.3+. * Do not warn about 'abstract-method' when the abstract method - is implemented through assignment (#155). + is implemented through assignment -* Improve cyclic import detection in the case of packages, patch by Buck - Golemon + Closes #155 + +* Improve cyclic import detection in the case of packages, patch by Buck Golemon * Add new warnings for checking proper class __slots__: ``invalid-slots-object`` and ``invalid-slots``. * Search for rc file in `~/.config/pylintrc` if `~/.pylintrc` - doesn't exists (#121) + doesn't exists + + Closes #121 + +* Don't register the new style checker w/ python >= 3 + +* Fix unused-import false positive w/ augment assignment + + Closes #78 -* Don't register the newstyle checker w/ python >= 3 +* Fix access-member-before-definition false negative wrt aug assign -* Fix unused-import false positive w/ augment assignment (#78) + Closes #164 -* Fix access-member-before-definition false negative wrt aug assign (#164) +* Do not attempt to analyze non python file, e.g. .so file -* Do not attempt to analyze non python file, e.g. .so file (#122) + Closes #122 diff --git a/doc/whatsnew/1/1.3.rst b/doc/whatsnew/1/1.3.rst index 49616e813b..4b3d4dd86d 100644 --- a/doc/whatsnew/1/1.3.rst +++ b/doc/whatsnew/1/1.3.rst @@ -5,25 +5,36 @@ Release date: 2014-07-26 * Allow hanging continued indentation for implicitly concatenated - strings. Closes issue #232. + strings. + + Closes #232. * Pylint works under Python 2.5 again, and its test suite passes. * Fix some false positives for the cellvar-from-loop warnings. - Closes issue #233. + + Closes #233. * Return new astroid class nodes when the inferencer can detect that that result of a function invocation on a type (like ``type`` or - `abc.ABCMeta`) is requested. Closes #205. + `abc.ABCMeta`) is requested. + + Closes #205. * Emit 'undefined-variable' for undefined names when using the Python 3 ``metaclass=`` argument. -* Checkers respect priority now. Close issue #229. +* Checkers respect priority now. + + Closes #229 + +* Fix a false positive regarding W0511. -* Fix a false positive regarding W0511. Closes issue #149. + Closes #149. -* Fix unused-import false positive with Python 3 metaclasses (#143). +* Fix unused-import false positive with Python 3 metaclasses + + Closes #143 * Don't warn with 'bad-format-character' when encountering the 'a' format on Python 3. @@ -34,15 +45,23 @@ Release date: 2014-07-26 'missing-format-attribute' and 'invalid-format-index'. * Issue broad-except and bare-except even if the number - of except handlers is different than 1. Fixes issue #113. + of except handlers is different than 1. + + Closes #113 * Issue attribute-defined-outside-init for all cases, not just - for the last assignment. Closes issue #262. + for the last assignment. + + Closes #262 -* Emit 'not-callable' when calling properties. Closes issue #268. +* Emit 'not-callable' when calling properties. + + Closes #268. * Fix a false positive with unbalanced iterable unpacking, - when encountering starred nodes. Closes issue #273. + when encountering starred nodes. + + Closes #273. * Add new checks, 'invalid-slice-index' and 'invalid-sequence-index' for invalid sequence and slice indices. @@ -51,25 +70,35 @@ Release date: 2014-07-26 attributes not defined in slots. * Don't emit 'no-name-in-module' for ignored modules. - Closes issue #223. + + Closes #223. * Fix an 'unused-variable' false positive, where the variable is - assigned through an import. Closes issue #196. + assigned through an import. + + Closes #196. * Definition order is considered for classes, function arguments - and annotations. Closes issue #257. + and annotations. + + Closes #257. * Don't emit 'unused-variable' when assigning to a nonlocal. - Closes issue #275. + + Closes #275. * Do not let ImportError propagate from the import checker, leading to crash - in some namespace package related cases. Closes issue #203. + in some namespace package related cases. + + Closes #203. * Don't emit 'pointless-string-statement' for attribute docstrings. - Closes issue #193. + + Closes #193. * Use the proper mode for pickle when opening and writing the stats file. - Closes issue #148. + + Closes #148. * Don't emit hidden-method message when the attribute has been monkey-patched, you're on your own when you do that. @@ -78,7 +107,10 @@ Release date: 2014-07-26 module as the offended class, avoiding to mangle the output in some cases. * Don't emit 'unnecessary-lambda' if the body of the lambda call contains - call chaining. Closes issue #243. + call chaining. + + Closes #243. * Don't emit 'missing-docstring' when the actual docstring uses ``.format``. - Closes issue #281. + + Closes #281. diff --git a/doc/whatsnew/1/1.4.rst b/doc/whatsnew/1/1.4.rst index b1bd57f242..c7088a5b79 100644 --- a/doc/whatsnew/1/1.4.rst +++ b/doc/whatsnew/1/1.4.rst @@ -6,7 +6,6 @@ What's New in Pylint 1.4.3? =========================== Release date: 2015-03-14 - * Remove three warnings: star-args, abstract-class-little-used, abstract-class-not-used. These warnings don't add any real value and they don't imply errors or problems in the code. @@ -27,28 +26,41 @@ What's New in Pylint 1.4.2? =========================== Release date: 2015-03-11 -* Don't require a docstring for empty modules. Closes issue #261. +* Don't require a docstring for empty modules. + + Closes #261 * Fix a false positive with ``too-few-format-args`` string warning, emitted when the string format contained a normal positional argument ('{0}'), mixed with a positional argument which did an attribute access ('{0.__class__}'). - Closes issue #463. + + Closes #463 * Take in account all the methods from the ancestors - when checking for too-few-public-methods. Closes issue #471. + when checking for too-few-public-methods. + + Closes #471 * Catch enchant errors and emit 'invalid-characters-in-docstring' - when checking for spelling errors. Closes issue #469. + when checking for spelling errors. + + Closes #469 * Use all the inferred statements for the super-init-not-called - check. Closes issue #389. + check. + + Closes #389 * Add a new warning, 'unichr-builtin', emitted by the Python 3 - porting checker, when the unichr builtin is found. Closes issue #472. + porting checker, when the unichr builtin is found. + + Closes #472 * Add a new warning, 'intern-builtin', emitted by the Python 3 - porting checker, when the intern builtin is found. Closes issue #473. + porting checker, when the intern builtin is found. + + Closes #473 * Add support for editable installations. @@ -64,10 +76,13 @@ Release date: 2015-03-11 * Add a new warning, 'unidiomatic-typecheck', emitted when an explicit typecheck uses type() instead of isinstance(). For example, `type(x) == Y` instead of `isinstance(x, Y)`. Patch by Chris Rebert. - Closes issue #299. + + Closes #299 * Add support for combining the Python 3 checker mode with the --jobs - flag (--py3k and --jobs). Closes issue #467. + flag (--py3k and --jobs). + + Closes #467 * Add a new warning for the Python 3 porting checker, 'using-cmp-argument', emitted when the ``cmp`` argument for the ``list.sort`` or ``sorted builtin`` @@ -75,7 +90,9 @@ Release date: 2015-03-11 * Make the --py3k flag commutative with the -E flag. Also, this patch fixes the leaks of error messages from the Python 3 checker when - the errors mode was activated. Closes issue #437. + the errors mode was activated. + + Closes #437 What's New in Pylint 1.4.1? @@ -83,21 +100,26 @@ What's New in Pylint 1.4.1? Release date: 2015-01-16 * Look only in the current function's scope for bad-super-call. - Closes issue #403. + + Closes #403 * Check the return of properties when checking for not-callable. - Closes issue #406. + + Closes #406 * Warn about using the input() or round() built-ins for Python 3. - Closes issue #411. -* Proper abstract method lookup while checking for - abstract-class-instantiated. Closes issue #401. + Closes #411 -* Use a mro traversal for finding abstract methods. Closes issue #415. +* Proper abstract method lookup while checking for abstract-class-instantiated. -* Fix a false positive with catching-non-exception and tuples of - exceptions. + Closes #401 + +* Use a mro traversal for finding abstract methods. + + Closes #415 + +* Fix a false positive with catching-non-exception and tuples of exceptions. * Fix a false negative with raising-non-exception, when the raise used an uninferrable exception context. @@ -106,7 +128,9 @@ Release date: 2015-01-16 raising tuples in the form 'raise (ZeroDivisionError, None)'. * Fix a false positive with invalid-slots-objects, where the slot entry - was a unicode string on Python 2. Closes issue #421. + was a unicode string on Python 2. + + Closes #421 * Add a new warning, 'redundant-unittest-assert', emitted when using unittest's methods assertTrue and assertFalse with constant value @@ -115,7 +139,9 @@ Release date: 2015-01-16 * Add a new JSON reporter, usable through -f flag. * Add the method names for the 'signature-differs' and 'argument-differs' - warnings. Closes issue #433. + warnings. + + Closes #433 * Don't compile test files when installing. @@ -139,7 +165,9 @@ Release date: 2014-11-23 compatibility for a while now * Don't try to analyze string formatting with objects coming from - function arguments. Closes issue #373. + function arguments. + + Closes #373 * Port source code to be Python 2/3 compatible. This drops the need for 2to3, but does drop support for Python 2.5. @@ -149,7 +177,9 @@ Release date: 2014-11-23 all messages that were emitted even though an inference failure happened during checking. -* Improved presenting unused-import message. Closes issue #293. +* Improved presenting unused-import message. + + Closes #293 * Add new checker for finding spelling errors. New messages: wrong-spelling-in-comment, wrong-spelling-in-docstring. @@ -163,54 +193,76 @@ Release date: 2014-11-23 * 'dangerous-default-value' no longer evaluates the value of the arguments, which could result in long error messages or sensitive data being leaked. - Closes issue #282 + + Closes #282 * Fix a false positive with string formatting checker, when encountering a string which uses only position-based arguments. - Closes issue #285. + + Closes #285 * Fix a false positive with string formatting checker, when using - keyword argument packing. Closes issue #288. + keyword argument packing. + + Closes #288 * Proper handle class level scope for lambdas. * Handle 'too-few-format-args' or 'too-many-format-args' for format - strings with both named and positional fields. Closes issue #286. + strings with both named and positional fields. + + Closes #286 + +* Analyze only strings by the string format checker. -* Analyze only strings by the string format checker. Closes issue #287. + Closes #287 -* Properly handle nested format string fields. Closes issue #294. +* Properly handle nested format string fields. + + Closes #294 * Don't emit 'attribute-defined-outside-init' if the attribute - was set by a function call in a defining method. Closes issue #192. + was set by a function call in a defining method. + + Closes #192 * Properly handle unicode format strings for Python 2. - Closes issue #296. + + Closes #296 * Don't emit 'import-error' if an import was protected by a try-except, which excepted ImportError. * Fix an 'unused-import' false positive, when the error was emitted for all the members imported with 'from import' form. - Closes issue #304. + + Closes #304 * Don't emit 'invalid-name' when assigning a name in an - ImportError handler. Closes issue #302. + ImportError handler. + + Closes #302 * Don't count branches from nested functions. * Fix a false positive with 'too-few-format-args', when the format strings contains duplicate manual position arguments. - Closes issue #310. + + Closes #310 * fixme regex handles comments without spaces after the hash. - Closes issue #311. + + Closes #311 * Don't emit 'unused-import' when a special object is imported - (__all__, __doc__ etc.). Closes issue #309. + (__all__, __doc__ etc.). + + Closes #309 * Look in the metaclass, if defined, for members not found in the current - class. Closes issue #306. + class. + + Closes #306 * Don't emit 'protected-access' if the attribute is accessed using a property defined at the class level. @@ -220,45 +272,65 @@ Release date: 2014-11-23 * Check that a class has an explicitly defined metaclass before emitting 'old-style-class' for Python 2. -* Emit 'catching-non-exception' for non-class nodes. Closes issue #303. +* Emit 'catching-non-exception' for non-class nodes. + + Closes #303 * Order of reporting is consistent. * Add a new warning, 'boolean-datetime', emitted when an instance - of 'datetime.time' is used in a boolean context. Closes issue #239. + of 'datetime.time' is used in a boolean context. + + Closes #239 * Fix a crash which occurred while checking for 'method-hidden', when the parent frame was something different than a function. -* Generate html output for missing files. Closes issue #320. +* Generate html output for missing files. + + Closes #320 * Fix a false positive with 'too-many-format-args', when the format string contains mixed attribute access arguments and manual - fields. Closes issue #322. + fields. + + Closes #322 * Extend the cases where 'undefined-variable' and 'used-before-assignment' - can be detected. Closes issue #291. + can be detected. + + Closes #291 * Add support for customising callback identifiers, by adding a new - '--callbacks' command line option. Closes issue #326. + '--callbacks' command line option. + + Closes #326 * Add a new warning, 'logging-format-interpolation', emitted when .format() string interpolation is used within logging function calls. * Don't emit 'unbalanced-tuple-unpacking' when the rhs of the assignment - is a variable length argument. Closes issue #329. + is a variable length argument. + + Closes #329 * Add a new warning, 'inherit-non-class', emitted when a class inherits - from something which is not a class. Closes issue #331. + from something which is not a class. + + Closes #331 * Fix another false positives with 'undefined-variable', where the variable can be found as a class assignment and used in a function annotation. - Closes issue #342. + + Closes #342 * Handle assignment of the string format method to a variable. - Closes issue #351. -* Support wheel packaging format for PyPi. Closes issue #334. + Closes #351 + +* Support wheel packaging format for PyPi. + + Closes #334 * Check that various built-ins that do not exist in Python 3 are not used: apply, basestring, buffer, cmp, coerce, execfile, file, long @@ -269,18 +341,24 @@ Release date: 2014-11-23 __oct__, __nonzero__ and __hex__. * Don't emit 'assigning-non-slot' when the assignment is for a property. - Closes issue #359. + + Closes #359 * Fix for regression: '{path}' was no longer accepted in '--msg-template'. * Report the percentage of all messages, not just for errors and warnings. - Closes issue #319. + + Closes #319 * 'too-many-public-methods' is reported only for methods defined in a class, - not in its ancestors. Closes issue #248. + not in its ancestors. + + Closes #248 * 'too-many-lines' disable pragma can be located on any line, not only the - first. Closes issue #321. + first. + + Closes #321 * Warn in Python 2 when an import statement is found without a corresponding ``from __future__ import absolute_import``. @@ -289,7 +367,9 @@ Release date: 2014-11-23 a corresponding ``from __future__ import division``. * Add a new option, 'exclude-protected', for excluding members - from the protected-access warning. Closes issue #48. + from the protected-access warning. + + Closes #48 * Warn in Python 2 when using dict.iter*(), dict.view*(); none of these methods are available in Python 3. diff --git a/doc/whatsnew/1/1.5.rst b/doc/whatsnew/1/1.5.rst index d39db73f0f..1f33b21694 100644 --- a/doc/whatsnew/1/1.5.rst +++ b/doc/whatsnew/1/1.5.rst @@ -12,12 +12,12 @@ Release date: 2016-03-21 it didn't run when everything but one pattern was disabled, leading to spurious false positives - Close #852 + Closes #852 * Don't emit unsubscriptable-value for classes with unknown base classes. - Close #776. + Closes #776. * Use an OrderedDict for storing the configuration elements @@ -27,13 +27,13 @@ Release date: 2016-03-21 was to disable them. The best example for this was in the context of running multiple processes, each one of it having different enables / disables that affected the output. - Close #815 + Closes #815 * Don't consider bare and broad except handlers as ignoring NameError, AttributeError and similar exceptions, in the context of checkers for these issues. - Closes issue #826 + Closes #826 What's New in Pylint 1.5.4? @@ -55,7 +55,7 @@ Release date: 2016-01-11 * Handle the import fallback idiom with regard to wrong-import-order. - Closes issue #750. + Closes #750 * Decouple the displaying of reports from the displaying of messages @@ -68,7 +68,8 @@ Release date: 2016-01-11 displayed with Reporter.display_message, while the reports are displayed with display_reports. - Closes issues #766 and #765. + Closes #766 + Closes #765 * Ignore function calls with variadic arguments without a context. @@ -77,22 +78,23 @@ Release date: 2016-01-11 some cases to false positives with regard to no-value-for-parameter. In order to avoid this, until we'll have support for call context propagation, we're ignoring such cases if detected. - Closes issue #722. + + Closes #722 * Treat AsyncFunctionDef just like FunctionDef nodes, by implementing visit_asyncfunctiondef in terms of visit_functiondef. - Closes issue #767. + Closes #767 * Take in account kwonlyargs when verifying that arguments are defined with the check_docs extension. - Closes issue #745. + Closes #745 * Suppress reporting 'unneeded-not' inside ``__ne__`` methods - Closes issue #749. + Closes #749 What's New in Pylint 1.5.2? @@ -102,7 +104,7 @@ Release date: 2015-12-21 * Don't crash if graphviz is not installed, instead emit a warning letting the user to know. - Closes issue #168. + Closes #168 * Accept only functions and methods for the deprecated-method checker. @@ -110,11 +112,12 @@ Release date: 2015-12-21 .qname() method after the inference. * Don't emit super-on-old-class on classes with unknown bases. - Closes issue #721. + + Closes #721 * Allow statements in ``if`` or ``try`` blocks containing imports. - Closes issue #714. + Closes #714 What's New in Pylint 1.5.1? @@ -123,7 +126,9 @@ Release date: 2015-12-02 * Fix a crash which occurred when old visit methods are encountered - in plugin modules. Closes issue #711. + in plugin modules. + + Closes #711 * Add wrong-import-position to check_messages's decorator arguments for ImportChecker.leave_module @@ -135,11 +140,15 @@ Release date: 2015-12-02 leading to wrong-import-position being emitted by pylint. * Fix a crash which occurred when old visit methods are encountered - in plugin modules. Closes issue #711. + in plugin modules. + + Closes #711 * Don't emit import-self and cyclic-import for relative imports of modules with the same name as the package itself. - Closes issues #708 and #706. + + Closes #708 + Closes #706. What's New in Pylint 1.5.0? @@ -155,40 +164,53 @@ Release date: 2015-11-29 is emitted when code is mixed with imports, being recommended for the latter to be at the top of the file, in order to figure out easier by a human reader what dependencies a module has. - Closes issue #692. + + Closes #692 * Added a new refactoring warning, 'unneeded-not', emitted when an expression with the not operator could be simplified. - Closes issue #670. + + Closes #670 * Added a new refactoring warning, 'simplifiable-if-statement', used when an if statement could be reduced to a boolean evaluation - of its test. Closes issue #698. + of its test. + + Closes #698 * Added a new refactoring warning, 'too-many-boolean-expressions', used when an if statement contains too many boolean expressions, which makes the code less maintainable and harder to understand. - Closes issue #677. + + Closes #677 * Property methods are shown as attributes instead of functions in - pyreverse class diagrams. Closes Issue #284 + pyreverse class diagrams. + + Closes #284 * Add a new refactoring error, 'too-many-nested-blocks', which is emitted when a function or a method has too many nested blocks, which makes the - code less readable and harder to understand. Closes issue #668. + code less readable and harder to understand. + + Closes #668 * Add a new error, 'unsubscriptable-object', that is emitted when value used in subscription expression doesn't support subscription (i.e. doesn't define __getitem__ method). -* Don't warn about abstract classes instantiated in their own - body. Closes issue #627. +* Don't warn about abstract classes instantiated in their own body. + + Closes #627 * Obsolete options are not present by default in the generated - configuration file. Closes issue #632. + configuration file. + + Closes #632 * non-iterator-returned can detect classes with iterator-metaclasses. - Closes issue #679. + + Closes #679 * Add a new error, 'unsupported-membership-test', emitted when value to the right of the 'in' operator doesn't support membership test @@ -197,24 +219,33 @@ Release date: 2015-11-29 * Add new errors, 'not-an-iterable', emitted when non-iterable value is used in an iterating context (starargs, for-statement, comprehensions, etc), and 'not-a-mapping', emitted when non-mapping - value is used in a mapping context. Closes issue #563. + value is used in a mapping context. + + Closes #563 * Make 'no-self-use' checker not emit a warning if there is a 'super()' call inside the method. - Closes issue #667. + + Closes #667 * Add checker to identify multiple imports on one line. - Closes issue #598. + + Closes #598 * Fix unused-argument false positive when the "+=" operator is used. - Closes issue #518. + + Closes #518 * Don't emit import-error for ignored modules. PyLint will not emit import errors for any import which is, or is a subpackage of, a module in - the ignored-modules list. Closes issue #223. + the ignored-modules list. + + Closes #223 * Fix unused-import false positive when the import is used in a - class assignment. Closes issue #475 + class assignment. + + Closes #475 * Add a new error, 'not-context-manager', emitted when something that doesn't implement __enter__ and __exit__ is used in a with @@ -227,30 +258,41 @@ Release date: 2015-11-29 * Add a new warning, 'duplicate-except', emitted when there is an exception handler which handles an exception type that was handled - before. Closes issue #485. + before. + + Closes #485 * A couple of warnings got promoted to errors, since they could uncover potential bugs in the code. These warnings are: assignment-from-none, unbalanced-tuple-unpacking, unpacking-non-sequence, non-iterator-returned. - Closes issue #388. + + Closes #388 * Allow ending a pragma control with a semicolon. In this way, users can continue a pragma control with a reason for why it is used, as in `# pylint: disable=old-style-class;reason=...`. - Closes issue #449. -* --jobs can be used with --load-plugins now. Closes issue #456. + Closes #449 -* Improve the performance of --jobs when dealing only with a package - name. Closes issue #479. +* --jobs can be used with --load-plugins now. + + Closes #456 + +* Improve the performance of --jobs when dealing only with a package name. + + Closes #479 * Don't emit an unused-wildcard-import when the imported name comes from another module and it is in fact a __future__ name. -* The colorized reporter now works on Windows. Closes issue #96. +* The colorized reporter now works on Windows. + + Closes #96. * Remove pointless-except warning. It was previously disabled by - default and it wasn't very useful. Closes issue #506. + default and it wasn't very useful. + + Closes #506. * Fix a crash on Python 3 related to the string checker, which crashed when it encountered a bytes string with a .format @@ -265,9 +307,12 @@ Release date: 2015-11-29 emitted for private functions. * Don't emit redefined-outer-name for __future__ directives. - Closes issue #520. -* Provide some hints for the bad-builtin message. Closes issue #522. + Closes #520. + +* Provide some hints for the bad-builtin message. + + Closes #522. * When checking for invalid arguments to a callable, in typecheck.py, look up for the __init__ in case the found __new__ comes from builtins. @@ -275,7 +320,9 @@ Release date: 2015-11-29 Since the __new__ comes from builtins, it will not have attached any information regarding what parameters it expects, so the check will be useless. Retrieving __init__ in that case will at least - detect a couple of false negatives. Closes issue #429. + detect a couple of false negatives. + + Closes #429. * Don't emit no-member for classes with unknown bases. @@ -284,15 +331,21 @@ Release date: 2015-11-29 * Lookup in the implicit metaclass when checking for no-member, if the class in question has an implicit metaclass, which is - True for new style classes. Closes issue #438. + True for new style classes. + + Closes #438. * Add two new warnings, duplicate-bases and inconsistent-mro. duplicate-bases is emitted when a class has the same bases listed more than once in its bases definition, while inconsistent-mro - is emitted when no sane mro hierarchy can be determined. Closes issue #526. + is emitted when no sane mro hierarchy can be determined. + + Closes #526. + +* Remove interface-not-implemented warning. -* Remove interface-not-implemented warning. Closes issue #532. + Closes #532. * Remove the rest of interface checks: interface-is-not-class, missing-interface-method, unresolved-interface. The reason is that @@ -314,21 +367,26 @@ Release date: 2015-11-29 * Detect undefined variable cases, where the "definition" of an undefined variable was in del statement. Instead of emitting used-before-assignment, which is totally misleading, it now emits undefined-variable. - Closes issue #528. + + Closes #528. * Don't emit attribute-defined-outside-init and access-member-before-definition for mixin classes. Actual errors can occur in mixin classes, but this is - controlled by the ignore-mixin-members option. Closes issue #412. + controlled by the ignore-mixin-members option. + + Closes #412. * Improve the detection of undefined variables and variables used before assignment for variables used as default arguments to function, where the variable was first defined in the class scope. - Closes issue #342 and issue #404. + + Closes #342 and issue #404. * Add a new warning, 'unexpected-special-method-signature', which is emitted when a special method (dunder method) doesn't have the expected signature, which can lead to actual errors in the application code. - Closes issue #253. + + Closes #253. * Remove 'bad-context-manager' due to the inclusion of 'unexpected-special-method-signature'. @@ -348,7 +406,8 @@ Release date: 2015-11-29 * Add a new warning, 'using-constant-test', which is emitted when a conditional statement (If, IfExp) uses a test which is always constant, such as numbers, classes, functions etc. This is most likely an error from the user's part. - Closes issue #524. + + Closes #524. * Don't emit 'raising-non-exception' when the exception has unknown bases. We don't know what those bases actually are and it's better @@ -366,7 +425,9 @@ Release date: 2015-11-29 * Take in consideration differences between arguments of various type of functions (classmethods, staticmethods, properties) - when checking for ``arguments-differ``. Closes issue #548. + when checking for ``arguments-differ``. + + Closes #548. * astroid.inspector was moved to pylint.pyreverse, since it belongs there and it doesn't need to be in astroid. @@ -412,29 +473,39 @@ Release date: 2015-11-29 These were moved since they didn't belong in astroid. -* Enable misplaced-future for Python 3. Closes issue #580. +* Enable misplaced-future for Python 3. + + Closes #580. * Add a new error, 'nonlocal-and-global', which is emitted when a name is found to be both nonlocal and global in the same scope. - Closes issue #581. + + Closes #581. * ignored-classes option can work with qualified names (ignored-classes=optparse.Values) - Closes issue #297. + + Closes #297 * ignored-modules can work with qualified names as well as with Unix pattern - matching for recursive ignoring. Closes issues #244. + matching for recursive ignoring. + + Closes #244 * Improve detection of relative imports in non-packages, as well as importing missing modules with a relative import from a package. * Don't emit no-init if not all the bases from a class are known. - Closes issue #604. + + Closes #604. * --no-space-check option accepts ``empty-line`` as a possible option. - Closes issue #541. + + Closes #541. * --generate-rcfile generates by default human readable symbols - for the --disable option. Closes issue #608. + for the --disable option. + + Closes #608. * Improved the not-in-loop checker to properly detect more cases. @@ -452,7 +523,9 @@ Release date: 2015-11-29 project. At the same time, --include-ids and --symbols will also be removed - in Pylint 1.6. Closes issue #570. + in Pylint 1.6. + + Closes #570. * missing-module-attribute was removed and the corresponding CLI option, required-attributes, which is slated for removal @@ -477,7 +550,8 @@ Release date: 2015-11-29 leaks outside of the except block, it's nevertheless a behaviour that a user shouldn't depend upon, since it's not obvious to the reader of the code what exception will be raised and it will not be compatible with Python 3 anyhow. - Closes issue #633. + + Closes #633. * Bring logilab-common's ureports into pylint.reporters. @@ -485,11 +559,12 @@ Release date: 2015-11-29 having in Pylint all the components that were used from logilab-common. The API should be considered an implementation detail and can change at some point in the future. - Closes issue #621. + + Closes #621. * ``reimported`` is emitted for reimported objects on the same line. - Closes issue #639. + Closes #639. * Abbreviations of command line options are not supported anymore. @@ -497,21 +572,28 @@ Release date: 2015-11-29 a feature of pylint, this fact being only a side effect of using optparse. As this was the case, using --load-plugin or other abbreviation for --load-plugins never actually worked, while it also didn't raise - an error. Closes issue #424. + an error. + + Closes #424. * Add a new error, 'nonlocal-without-binding' The error is emitted on Python 3 when a nonlocal name is not bound - to any variable in the parents scopes. Closes issue #582. + to any variable in the parents scopes. + + Closes #582. * 'deprecated-module' can be shown for modules which aren't - available. Closes issue #362. + available. + + Closes #362. * Don't consider a class abstract if its members can't be properly inferred. This fixes a false positive related to abstract-class-instantiated. - Closes issue #648. + + Closes #648. * Add a new checker for the async features added by PEP 492. @@ -526,7 +608,9 @@ Release date: 2015-11-29 * Add a new convention warning, 'singleton-comparison', emitted when comparison to True, False or None is found. -* Don't emit 'assigning-non-slot' for descriptors. Closes issue #652. +* Don't emit 'assigning-non-slot' for descriptors. + + Closes #652. * Add a new error, 'repeated-keyword', when a keyword argument is passed multiple times into a function call. @@ -534,7 +618,9 @@ Release date: 2015-11-29 This is similar with redundant-keyword-arg, but it's mildly different that it needs to be a separate error. -* --enable=all can now be used. Closes issue #142. +* --enable=all can now be used. + + Closes #142. * Add a new convention message, 'misplaced-comparison-constant', emitted when a constant is placed in the left hand side of a comparison, @@ -545,10 +631,11 @@ Release date: 2015-11-29 * Add a new convention message, 'consider-using-enumerate', which is emitted when code that uses ``range`` and ``len`` for iterating is encountered. - Closes issue #684. + + Closes #684. * Added two new refactoring messages, 'no-classmethod-decorator' and 'no-staticmethod-decorator', which are emitted when a static method or a class method is declared without using decorators syntax. - Closes issue #675. + Closes #675. diff --git a/doc/whatsnew/1/1.6/full.rst b/doc/whatsnew/1/1.6/full.rst index fa02fb6448..3bcd37e826 100644 --- a/doc/whatsnew/1/1.6/full.rst +++ b/doc/whatsnew/1/1.6/full.rst @@ -7,7 +7,7 @@ Release date: 2016-07-18 * Do not crash when inferring uninferable exception types for docparams extension - Close #998 + Closes #998 What's new in Pylint 1.6.2? @@ -16,11 +16,11 @@ Release date: 2016-07-15 * Do not crash when printing the help of options with default regular expressions - Close #990 + Closes #990 * More granular versions for deprecated modules. - Close #991 + Closes #991 What's new in Pylint 1.6.1? @@ -37,19 +37,27 @@ Release date: 2016-07-03 * Added a new extension, ``pylint.extensions.mccabe``, for warning about complexity in code. -* Deprecate support for --optimize-ast. Part of #975. +* Deprecate support for --optimize-ast -* Deprecate support for the HTML output. Part of #975. + Fixes part of #975 -* Deprecate support for --output-files. Part of #975. +* Deprecate support for the HTML output -* Fixed a documentation error for the check_docs extension. Fixes #735. + Fixes part of #975 + +* Deprecate support for --output-files + + Fixes part of #975 + +* Fixed a documentation error for the check_docs extension. + + Closes #735 * Made the list of property-defining decorators configurable. * Fix a bug where the top name of a qualified import was detected as unused variable. - Close #923. + Closes #923 * bad-builtin is now an extension check. @@ -59,49 +67,49 @@ Release date: 2016-07-03 for ignoring every no-member error that is accessed as in ``astroid.node_classes.missing.object``. * Add the ability to ignore files based on regex matching, with the new ``--ignore-patterns`` - option. + option. Allow for multiple ignore patterns to be specified. Rather than clobber the existing + ignore option, we introduced a new one called ignore-patterns. - This addresses issue #156 by allowing for multiple ignore patterns - to be specified. Rather than clobber the existing ignore option, we - introduced a new one called ignore-patterns. + Closes #156 * Added a new error, 'trailing-newlines', which is emitted when a file has trailing new lines. - Closes issue #682. + Closes #682 * Add a new option, 'redefining-builtins-modules', for controlling the modules which can redefine builtins, such as six.moves and future.builtins. - Close #464. + Closes #464 * 'reimported' is emitted when the same name is imported from different module. - Close #162. + Closes #162 * Add a new recommendation checker, 'consider-iterating-dictionary', which is emitted which is emitted when a dictionary is iterated through .keys(). - Close #699 + Closes #699 * Use the configparser backport for Python 2 This fixes a problem we were having with comments inside values, which is fixed in Python 3's configparser. - Close #828 + + Closes #828 * A new error was added, 'invalid-length-returned', when the ``__len__`` special method returned something else than a non-negative number. - Close issue #557 + Closes #557 * Switch to using isort internally for wrong-import-order. - Closes #879. + Closes #879 * check_docs extension can find constructor parameters in __init__. - Closes #887. + Closes #887 * Don't warn about invalid-sequence-index if the indexed object has unknown base classes. @@ -117,4 +125,4 @@ Release date: 2016-07-03 trying to write compatible code. As such, we don't check these blocks by default, but the analysis can be enforced by using the new ``--analyse-fallback-block`` flag. - Close #769. + Closes #769. diff --git a/doc/whatsnew/1/1.7/full.rst b/doc/whatsnew/1/1.7/full.rst index 25933ba537..9e3234a02e 100644 --- a/doc/whatsnew/1/1.7/full.rst +++ b/doc/whatsnew/1/1.7/full.rst @@ -7,13 +7,14 @@ Release date: 2017-04-17 * Fix a false positive which occurred when an exception was reraised - Close #1419 + Closes #1419 * Fix a false positive of ``disallow-trailing-tuple`` The check was improved by verifying for non-terminating newlines, which should exempt function calls and function definitions from the check - Close #1424 + + Closes #1424 What's New in Pylint 1.7? @@ -23,7 +24,7 @@ Release date: 2017-04-13 * Don't emit missing-final-newline or trailing-whitespace for formfeeds (page breaks). - Close #1218 and #1219 + Closes #1218 and #1219 * Don't emit by default no-member if we have opaque inference objects in the inference results @@ -36,28 +37,28 @@ Release date: 2017-04-13 * Added new message ``assign-to-new-keyword`` to warn about assigning to names which will become a keyword in future Python releases. - Close #1351 + Closes #1351 * Split the 'missing or differing' in parameter documentation in different error. 'differing-param-doc' covers the differing part of the old 'missing-param-doc', and 'differing-type-doc' covers the differing part of the old 'missing-type-doc' - Close #1342 + Closes #1342 * Added a new error, 'used-prior-global-declaration', which is emitted when a name is used prior a global declaration in a function. This causes a SyntaxError in Python 3.6 - Close #1257 + Closes #1257 * The protocol checks are emitting their messages when a special method is set to None. - Close #1263 + Closes #1263 * Properly detect if imported name is assigned to same name in different scope. - Close #636, #848, #851, and #900 + Closes #636, #848, #851, and #900 * Require one space for annotations with type hints, as per PEP 8. @@ -70,7 +71,7 @@ Release date: 2017-04-13 * Don't emit not-callable for instances with unknown bases. - Close #1213 + Closes #1213 * Treat keyword only arguments the same as positional arguments with regard to unused-argument check @@ -90,7 +91,7 @@ Release date: 2017-04-13 * PyLinter.should_analyze_file has a new optional parameter, called ``is_argument`` - Close #1079 + Closes #1079 * Add attribute hints for missing members @@ -117,23 +118,29 @@ Release date: 2017-04-13 * Added a new error, 'invalid-metaclass', raised when we can detect that a class is using an improper metaclass. - Close #579 + Closes #579 * Added a new refactoring message, 'literal-comparison'. - Close #786 + Closes #786 * arguments-differ takes in consideration kwonlyargs and variadics - Close #983 + Closes #983 + +* Removed --optimized-ast + + Fixes part of #975 -* Removed --optimized-ast. Part of #975. +* Removed --files-output option -* Removed --files-output option. Part of #975. + Fixes part of #975 * Removed pylint-gui from the package. -* Removed the HTML reporter. Part of #975. +* Removed the HTML reporter + + Fixes part of #975 * ignored-argument-names is now used for ignoring arguments for unused-variable check. @@ -146,7 +153,8 @@ Release date: 2017-04-13 Also, the same option was moved from the design checker to the variables checker, which means that the option now appears under the ``[VARIABLES]`` section inside the configuration file. - Close #862. + + Closes #862. * Fix a false positive for keyword variadics with regard to keyword only arguments. @@ -154,11 +162,11 @@ Release date: 2017-04-13 with keyword variadics (\**kwargs), then we were emitting a missing-kwoa false positive, which is now fixed. - Close #934. + Closes #934. * Fix some false positives with unknown sized variadics. - Close #878 + Closes #878 * Added a new extension, check_docstring, for checking PEP 257 conventions. @@ -166,47 +174,54 @@ Release date: 2017-04-13 * config files with BOM markers can now be read. - Close #864. + Closes #864. * epylint.py_run does not crash on big files, using .communicate() instead of .wait() - Close #599 + Closes #599 * Disable reports by default and show the evaluation score by default - As per discussion from issue #746, the reports were disabled by - default in order to simplify the interaction between the tool - and the users. The score is still shown by default, as a way of - closely measuring when it increases or decreases due to changes + The reports were disabled by default in order to simplify the interaction + between the tool and the users. The score is still shown by default, as + a way of closely measuring when it increases or decreases due to changes brought to the code. -* Disable the information category messages by default. + Refs #746 - This is a step towards making pylint more sane, as - per the discussion from issue #746. +* Disable the information category messages by default. This is a step towards + making pylint more sane. + + Refs #746. * Catch more cases as not proper iterables for __slots__ with - regard to invalid-slots pattern. Closes issue #775. + regard to invalid-slots pattern. + + Closes #775 * empty indent strings are rejected. * Added a new error, 'relative-beyond-top-level', which is emitted when a relative import was attempted beyond the top level package. - Closes issue #588. + Closes #588 * Added a new warning, 'unsupported-assignment-operation', which is emitted when item assignment is tried on an object which doesn't - have this ability. Closes issue #591. + have this ability. + + Closes #591 * Added a new warning, 'unsupported-delete-operation', which is emitted when item deletion is tried on an object which doesn't - have this ability. Closes issue #592. + have this ability. + + Closes #592 * Fix a false positive of 'redundant-returns-doc', occurred when the documented function was using *yield* instead of *return*. - Closes issue #984. + Closes #984. * Fix false positives of 'missing-[raises|params|type]-doc' due to not recognizing keyword synonyms supported by Sphinx. @@ -215,7 +230,7 @@ Release date: 2017-04-13 emitted whenever we can detect that consecutive isinstance calls can be merged together. - Closes issue #968 + Closes #968 * Fix a false positive of 'missing-param-doc' and 'missing-type-doc', occurred when a class docstring uses the 'For the parameters, see' @@ -224,7 +239,7 @@ Release date: 2017-04-13 * ``redefined-outer-name`` is now also emitted when a nested loop's target variable is the same as a target variable in an outer loop. - Closes issue #911. + Closes #911. * Added proper exception type inference for 'missing-raises-doc'. @@ -246,7 +261,7 @@ Release date: 2017-04-13 * Added epytext support to docparams extension. - Closes #1029. + Closes #1029 * Support having plugins with the same name and with options defined @@ -305,7 +320,7 @@ Release date: 2017-04-13 * Bug-fix for false-positive logging-format-interpolation` when format specifications are used in formatted string. - Fixes #572 + Closes #572 * Added a new switch ``single-line-class-stmt`` to allow single-line declaration of empty class bodies. @@ -314,24 +329,24 @@ Release date: 2017-04-13 * Protected access in form ``type(self)._attribute`` are now allowed. - Fixes #1031 + Closes #1031 * Let the user modify msg-template when Pylint is called from a Python script - Fixes #1269 + Closes #1269 * Imports checker supports new switch ``allow-wildcard-with-all`` which disables warning on wildcard import when imported module defines ``__all__`` variable. - Fixes #831 + Closes #831 * ``too-many-format-args`` and ``too-few-format-args`` are emitted correctly when starred expression are used in RHS tuple. - Fixes #957 + Closes #957 * ``cyclic-import`` checker supports local disable clauses. When one of cycle imports was done in scope where disable clause was active, cycle is not reported as violation. - Fixes #59 + Closes #59 diff --git a/doc/whatsnew/1/1.8/full.rst b/doc/whatsnew/1/1.8/full.rst index fd6c8026d4..4452aae2dc 100644 --- a/doc/whatsnew/1/1.8/full.rst +++ b/doc/whatsnew/1/1.8/full.rst @@ -26,22 +26,22 @@ Release date: 2017-12-15 See https://bugs.python.org/issue15373 for details. - Close #1301 + Closes #1301 * Do not display no-absolute-import warning multiple times per file. * ``trailing-comma-tuple`` refactor check now extends to assignment with more than one element (such as lists) - Close #1713 + Closes #1713 * Fixing u'' string in superfluous-parens message - Close #1420 + Closes #1420 * ``abstract-class-instantiated`` is now emitted for all inference paths. - Close #1673 + Closes #1673 * Add set of predefined naming style to ease configuration of checking naming conventions. @@ -60,19 +60,19 @@ Release date: 2017-12-15 * The ``invalid-name`` check contains the name of the template that caused the failure - Close #1176 + Closes #1176 * Using the -j flag won't start more child linters than needed. - Contributed by Roman Ivanov in #1614 + Closes #1614 * Fix a false positive with bad-python3-import on relative imports - Close #1608 + Closes #1608 * Added a new Python 3 check, ``non-ascii-bytes-literals`` - Close #1545 + Closes #1545 * Added a couple of new Python 3 checks for accessing dict methods in non-iterable context @@ -84,18 +84,20 @@ Release date: 2017-12-15 receive the target argument, but receives just one argument, which is by default the group parameter. - Close #1327 + Closes #1327 * In non-quiet mode, absolute path of used config file is logged to standard error. - Close #1519 + + Closes #1519 * Raise meaningful exception for invalid reporter class being selected When unknown reporter class will be selected as Pylint reporter, meaningful error message would be raised instead of bare ``ImportError`` or ``AttribueError`` related to module or reporter class being not found. - Close #1388 + + Closes #1388 * Added a new Python 3 check for accessing removed functions from itertools like ``izip`` or ``ifilterfalse`` @@ -108,18 +110,21 @@ Release date: 2017-12-15 * Added a new key-value pair in json output. The key is ``message-id`` and the value is the message id. - Close #1512 + + Closes #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. - Close #1385 + + Closes #1385 * Added a new warning, ``raising-format-tuple``, to detect multi-argument exception construction instead of message string formatting. * Added a new check for method of logging module that concatenate string via + operator - Close #1479 + + Closes #1479 * Added parameter for limiting number of suggestions in spellchecking checkers @@ -128,66 +133,78 @@ Release date: 2017-12-15 When object ``A`` used in ``X and A or B`` was falsy in boolean context, Pylint incorrectly emitted non-equivalent ternary-based suggestion. After a change message is correctly not emitted for this case. - Close #1559 + + Closes #1559 * Added ``suggestion-mode`` configuration flag. When flag is enabled, informational message is emitted instead of cryptic error message for attributes accessed on c-extensions. - Close #1466 + + Closes #1466 * Fix a false positive ``useless-super-delegation`` message when parameters default values are different from those used in the base class. - Close #1085 + + Closes #1085 * Disabling 'wrong-import-order', 'wrong-import-position', or 'ungrouped-imports' for a single line now prevents that line from triggering violations on subsequent lines. - Close #1336 + Closes #1336 * Added a new Python check for inconsistent return statements inside method or function. - Close #1267 + + Closes #1267 * Fix ``superfluous-parens`` false positive related to handling logical statements involving ``in`` operator. - Close #574 + Closes #574 * ``function-redefined`` message is no longer emitted for functions and methods which names matches dummy variable name regular expression. - Close #1369 + + Closes #1369 * Fix ``missing-param-doc`` and ``missing-type-doc`` false positives when mixing ``Args`` and ``Keyword Args`` in Google docstring. - Close #1409 + + Closes #1409 * Fix ``missing-docstring`` false negatives when modules, classes, or methods consist of compound statements that exceed the ``docstring-min-length`` * Fix ``useless-else-on-loop`` false positives when break statements are deeply nested inside loop. - Close #1661 + + Closes #1661 * Fix no ``wrong-import-order`` message emitted on ordering of first and third party libraries. With this fix, pylint distinguishes third and first party modules when checking import order. - Close #1702 + + Closes #1702 * Fix ``pylint disable=fixme`` directives ignored for comments following the last statement in a file. - Close #1681 + + Closes #1681 * Fix ``line-too-long`` message deactivated by wrong disable directive. The directive ``disable=fixme`` doesn't deactivate anymore the emission of ``line-too-long`` message for long commented lines. - Close #1741 + + Closes #1741 * If the rcfile specified on the command line doesn't exist, then an IOError exception is raised. - Close #1747 + + Closes #1747 * Fix the wrong scope of the ``disable=`` directive after a commented line. For example when a ``disable=line-too-long`` directive is at the end of a long commented line, it no longer disables the emission of ``line-too-long`` message for lines that follow. - Close #1742 + + Closes #1742 diff --git a/doc/whatsnew/1/1.8/summary.rst b/doc/whatsnew/1/1.8/summary.rst index b06197b456..ffde5a20e6 100644 --- a/doc/whatsnew/1/1.8/summary.rst +++ b/doc/whatsnew/1/1.8/summary.rst @@ -216,9 +216,10 @@ New checkers except StopIteration: return - The check about raising a StopIteration inside a generator is also valid if the exception +* The check about raising a StopIteration inside a generator is also valid if the exception raised inherit from StopIteration. - Close #1385 + + Closes #1385 .. _PEP479: https://peps.python.org/pep-0479 @@ -263,7 +264,7 @@ New checkers elif arg < 20: return None - Close #1267 + Closes #1267 .. _PEP8: https://peps.python.org/pep-0008 diff --git a/doc/whatsnew/1/1.9/full.rst b/doc/whatsnew/1/1.9/full.rst index 9e4bacaa24..e6ee39b915 100644 --- a/doc/whatsnew/1/1.9/full.rst +++ b/doc/whatsnew/1/1.9/full.rst @@ -28,12 +28,12 @@ Release date: 2018-05-15 * Enum classes do not trigger ``too-few-methods`` - Close #605 + Closes #605 * Added a new Python 2/3 check for accessing ``operator.div``, which is removed in Python 3 - Close #1936 + Closes #1936 * Added a new Python 2/3 check for accessing removed urllib functions - Close #1997 + Closes #1997 diff --git a/doc/whatsnew/2/2.0/full.rst b/doc/whatsnew/2/2.0/full.rst index 23a5d7c5b5..39e626d86f 100644 --- a/doc/whatsnew/2/2.0/full.rst +++ b/doc/whatsnew/2/2.0/full.rst @@ -8,24 +8,24 @@ Release date: 2018-07-15 * ``try-except-raise`` should not be emitted if there are any parent exception class handlers. - Close #2284 + Closes #2284 * ``trailing-comma-tuple`` can be emitted for ``return`` statements as well. - Close #2269 + Closes #2269 * Fix a false positive ``inconsistent-return-statements`` message when exception is raised inside an else statement. - Close #1782 + Closes #1782 * ``ImportFrom`` nodes correctly use the full name for the import sorting checks. - Close #2181 + Closes #2181 * [].extend and similar builtin operations don't emit `dict-*-not-iterating` with the Python 3 porting checker - Close #2187 + Closes #2187 * Add a check ``consider-using-dict-comprehension`` which is emitted if for dict initialization the old style with list comprehensions is used. @@ -35,13 +35,13 @@ Release date: 2018-07-15 * ``logging-not-lazy`` is emitted whenever pylint infers that a string is built with addition - Close #2193 + Closes #2193 * Add a check ``chained-comparison`` which is emitted if a boolean operation can be simplified by chaining some of its operations. e.g "a < b and b < c", can be simplified as "a < b < c". - Close #2032 + Closes #2032 * Add a check ``consider-using-in`` for comparisons of a variable against multiple values with "==" and "or"s instead of checking if the variable @@ -49,62 +49,62 @@ Release date: 2018-07-15 * ``in`` is considered iterating context for some of the Python 3 porting checkers - Close #2186 + Closes #2186 * Add ``--ignore-none`` flag to control if pylint should warn about ``no-member`` where the owner is None * Fix a false positive related to ``too-many-arguments`` and bounded ``__get__`` methods - Close #2172 + Closes #2172 * ``mcs`` as the first parameter of metaclass's ``__new__`` method was replaced by ``cls`` - Close #2028 + Closes #2028 * ``assignment-from-no-return`` considers methods as well. - Close #2081 + Closes #2081 * Support typing.TYPE_CHECKING for *unused-import* errors - Close #1948 + Closes #1948 * Inferred classes at a function level no longer emit ``invalid-name`` when they don't respect the variable regular expression - Close #1049 + Closes #1049 * Added basic support for postponed evaluation of function annotations. - Close #2069 + Closes #2069 * Fix a bug with ``missing-kwoa`` and variadics parameters - Close #1111 + Closes #1111 * ``simplifiable-if-statement`` takes in account only when assigning to same targets - Close #1984 + Closes #1984 * Make ``len-as-condition`` test more cases, such as ``len() < 1`` or ``len <= 0`` * Fix false-positive ``line-too-long`` message emission for commented line at the end of a module - Close #1950 + Closes #1950 * Fix false-positive ``bad-continuation`` for with statements - Close #461 + Closes #461 * Don't warn about ``stop-iteration-return`` when using ``next()`` over ``itertools.count`` - Close #2158 + Closes #2158 * Add a check ``consider-using-get`` for unidiomatic usage of value/default-retrieval for a key from a dictionary - Close #2076 + Closes #2076 * invalid-slice-index is not emitted when the slice is used as index for a complex object. @@ -115,38 +115,39 @@ Release date: 2018-07-15 * Add a new check 'useless-import-alias'. - Close #2052 + Closes #2052 * Add ``comparison-with-callable`` to warn for comparison with bare callable, without calling it. - Close #2082 + Closes #2082 * Don't warn for ``missing-type-doc`` and/or ``missing-return-type-doc``, if type annotations exist on the function signature for a parameter and/or return type. - Close #2083 + + Closes #2083 * 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 + Closes #2042 * Warn if the first argument of an instance/ class method gets assigned - Close #977 + Closes #977 * New check ``comparison-with-itself`` to check comparison between same value. - Close #2051 + Closes #2051 * Add a new warning, 'logging-fstring-interpolation', emitted when f-string is used within logging function calls. - Close #1998 + Closes #1998 * Don't show 'useless-super-delegation' if the subclass method has different type annotations. - Close #1923 + Closes #1923 * Add ``unhashable-dict-key`` check. @@ -154,52 +155,52 @@ Release date: 2018-07-15 * Don't warn that a global variable is unused if it is defined by an import - Close #1453 + Closes #1453 * Skip wildcard import check for ``__init__.py``. - Close #2026 + Closes #2026 * The Python 3 porting mode can now run with Python 3 as well. * ``too-few-public-methods`` is not emitted for dataclasses. - Close #1793 + Closes #1793 * New verbose mode option, enabled with ``--verbose`` command line flag, to display of extra non-checker-related output. It is disabled by default. - Close #1863 + Closes #1863 * ``undefined-loop-variable`` takes in consideration non-empty iterred objects before emitting - Close #2039 + Closes #2039 * Add support for numpydoc optional return value names. - Close #2030 + Closes #2030 * ``singleton-comparison`` accounts for negative checks - Close #2037 + Closes #2037 * Add a check ``consider-using-in`` for comparisons of a variable against multiple values with "==" and "or"s instead of checking if the variable is contained "in" a tuple of those values. - Close #1977 + Closes #1977 * defaultdict and subclasses of dict are now handled for dict-iter-* checks - Close #2005 + Closes #2005 * ``logging-format-interpolation`` also emits when f-strings are used instead of % syntax. - Close #1788 + Closes #1788 * Don't trigger misplaced-bare-raise when the raise is in a finally clause - Close #1924 + Closes #1924 * Add a new check, ``possibly-unused-variable``. @@ -210,7 +211,7 @@ Release date: 2018-07-15 allows to disable this error when the user intentionally uses ``locals()`` to consume everything. - Close #1909. + Closes #1909. * ``no-else-return`` accounts for multiple cases @@ -220,7 +221,7 @@ Release date: 2018-07-15 other cases, for instance it now detects TryExcept nodes that are part of the .else branch. - Close #1852 + Closes #1852 * Added two new checks, ``invalid-envvar-value`` and ``invalid-envvar-default``. @@ -230,11 +231,11 @@ Release date: 2018-07-15 * Add a check ``consider-using-join`` for concatenation of strings using str.join(sequence) - Close #1952 + Closes #1952 * Add a check ``consider-swap-variables`` for swapping variables with tuple unpacking - Close #1922 + Closes #1922 * Add new checker ``try-except-raise`` that warns the user if an except handler block has a ``raise`` statement as its first operator. The warning is shown when there is @@ -243,7 +244,7 @@ Release date: 2018-07-15 * Don't crash on invalid strings when checking for ``logging-format-interpolation`` - Close #1944 + Closes #1944 * Exempt ``__doc__`` from triggering a ``redefined-builtin`` @@ -253,59 +254,59 @@ Release date: 2018-07-15 * Fix false positive bad-whitespace from function arguments with default values and annotations - Close #1831 + Closes #1831 * Fix stop-iteration-return false positive when next builtin has a default value in a generator - Close #1830 + Closes #1830 * Fix emission of false positive ``no-member`` message for class with "private" attributes whose name is mangled. - Close #1643 + Closes #1643 * Fixed a crash which occurred when ``Uninferable`` wasn't properly handled in ``stop-iteration-return`` - Close #1779 + Closes #1779 * Use the proper node to get the name for redefined functions (#1792) - Close #1774 + Closes #1774 * Don't crash when encountering bare raises while checking inconsistent returns - Close #1773 + Closes #1773 * Fix a false positive ``inconsistent-return-statements`` message when if statement is inside try/except. - Close #1770 + Closes #1770 * Fix a false positive ``inconsistent-return-statements`` message when while loop are used. - Close #1772 + Closes #1772 * Correct column number for whitespace conventions. Previously the column was stuck at 0 - Close #1649 + Closes #1649 * Fix ``unused-argument`` false positives with overshadowed variable in dictionary comprehension. - Close #1731 + Closes #1731 * Fix false positive ``inconsistent-return-statements`` message when never returning functions are used (i.e sys.exit for example). - Close #1771 + Closes #1771 * Fix error when checking if function is exception, as in ``bad-exception-context``. * Fix false positive ``inconsistent-return-statements`` message when a function is defined under an if statement. - Close #1794 + Closes #1794 * New ``useless-return`` message when function or method ends with a "return" or "return None" statement and this is the only return statement in the body. @@ -313,73 +314,73 @@ Release date: 2018-07-15 * Fix false positive ``inconsistent-return-statements`` message by avoiding useless exception inference if the exception is not handled. - Close #1794 (second part) + Closes #1794 (second part) * Fix bad thread instantiation check when target function is provided in args. - Close #1840 + Closes #1840 * Fixed false positive when a numpy Attributes section follows a Parameters section - Close #1867 + Closes #1867 * Fix incorrect file path when file absolute path contains multiple ``path_strip_prefix`` strings. - Close #1120 + Closes #1120 * Fix false positive undefined-variable for lambda argument in class definitions - Close #1824 + Closes #1824 * Add of a new checker that warns the user if some messages are enabled or disabled by id instead of symbol. - Close #1599 + Closes #1599 * Suppress false-positive ``not-callable`` messages from certain staticmethod descriptors - Close #1699 + Closes #1699 * Fix indentation handling with tabs - Close #1148 + Closes #1148 * Fix false-positive ``bad-continuation`` error - Close #638 + Closes #638 * Fix false positive unused-variable in lambda default arguments - Close #1921 - Close #1552 - Close #1099 - Close #210 + Closes #1921 + Closes #1552 + Closes #1099 + Closes #210 * Updated the default report format to include paths that can be clicked on in some terminals (e.g. iTerm). * Fix inline def behavior with ``too-many-statements`` checker - Close #1978 + Closes #1978 * Fix ``KeyError`` raised when using docparams and NotImplementedError is documented. - Close #2102 + Closes #2102 * Fix 'method-hidden' raised when assigning to a property or data descriptor. * Fix emitting ``useless-super-delegation`` when changing the default value of keyword arguments. - Close #2022 + Closes #2022 * Expand ignored-argument-names include starred arguments and keyword arguments - Close #2214 + Closes #2214 * Fix false-positive undefined-variable in nested lambda - Close #760 + Closes #760 * Fix false-positive ``bad-whitespace`` message for typing annoatations with ellipses in them diff --git a/doc/whatsnew/2/2.1/full.rst b/doc/whatsnew/2/2.1/full.rst index 2e24f8f457..a1e7e24c15 100644 --- a/doc/whatsnew/2/2.1/full.rst +++ b/doc/whatsnew/2/2.1/full.rst @@ -7,11 +7,11 @@ Release date: 2018-08-07 * fix pylint crash due to ``misplaced-format-function`` not correctly handling class attribute. - Close #2384 + Closes #2384 * Do not emit \*-builtin for Python 3 builtin checks when the builtin is used inside a try-except - Close PyCQA/pylint#2228 + Closes #2228 * ``simplifiable-if-statement`` not emitted when dealing with subscripts @@ -23,26 +23,26 @@ Release date: 2018-08-01 * ``trailing-comma-tuple`` gets emitted for ``yield`` statements as well. - Close #2363 + Closes #2363 * Get only the arguments of the scope function for ``redefined-argument-from-local`` - Close #2364 + Closes #2364 * Add a check ``misplaced-format-function`` which is emitted if format function is used on non str object. - Close #2200 + Closes #2200 * ``chain.from_iterable`` no longer emits `dict-{}-not-iterating` when dealing with dict values and keys * Demote the ``try-except-raise`` message from an error to a warning (E0705 -> W0706) - Close #2323 + Closes #2323 * Correctly handle the new name of the Python implementation of the ``abc`` module. - Close PyCQA/astroid#2288 + Closes PyCQA/astroid#2288 * Modules with ``__getattr__`` are exempted by default from ``no-member`` @@ -51,47 +51,48 @@ Release date: 2018-08-01 Instead we assume the safe thing to do, in the same way we do for classes, and skip those modules from checking. - Close #2331 + Closes #2331 * Fix a false positive ``invalid name`` message when method or attribute name is longer then 30 characters. - Close #2047 + Closes #2047 * Include the type of the next branch in ``no-else-return`` - Close #2295 + Closes #2295 * Fix inconsistent behaviour for bad-continuation on first line of file - Close #2281 + Closes #2281 * Fix not being able to disable certain messages on the last line through the global disable option - Close #2278 + Closes #2278 * Don't emit ``useless-return`` when we have a single statement that is the return itself We still want to be explicit when a function is supposed to return an optional value; even though ``pass`` could still work, it's not explicit enough and the function might look like it's missing an implementation. - Close #2300 + + Closes #2300 * Fix false-positive undefined-variable for self referential class name in lamdbas - Close #704 + Closes #704 * Don't crash when ``pylint`` is unable to infer the value of an argument to ``next()`` - Close #2316 + Closes #2316 * Don't emit ``not-an-iterable`` when dealing with async iterators. But do emit it when using the usual iteration protocol against async iterators. - Close #2311 + Closes #2311 * Can specify a default docstring type for when the check cannot guess the type - Close #1169 + Closes #1169 diff --git a/doc/whatsnew/2/2.10/full.rst b/doc/whatsnew/2/2.10/full.rst index c4bbddcb04..7505890997 100644 --- a/doc/whatsnew/2/2.10/full.rst +++ b/doc/whatsnew/2/2.10/full.rst @@ -57,7 +57,7 @@ Release date: 2021-08-20 * Added ``ignored-parents`` option to the design checker to ignore specific classes from the ``too-many-ancestors`` check (R0901). - Partially closes #3057 + Fixes part of #3057 * Added ``unspecified-encoding``: Emitted when open() is called without specifying an encoding @@ -65,12 +65,12 @@ Release date: 2021-08-20 * Improved the Similarity checker performance. Fix issue with ``--min-similarity-lines`` used with ``--jobs``. - Close #4120 - Close #4118 + Closes #4120 + Closes #4118 * Don't emit ``no-member`` error if guarded behind if statement. - Ref #1162 + Refs #1162 Closes #1990 Closes #4168 diff --git a/doc/whatsnew/2/2.10/summary.rst b/doc/whatsnew/2/2.10/summary.rst index 0ccdd26588..6b3689643f 100644 --- a/doc/whatsnew/2/2.10/summary.rst +++ b/doc/whatsnew/2/2.10/summary.rst @@ -94,7 +94,7 @@ Other Changes * Don't emit ``no-member`` error if guarded behind if statement. - Ref #1162 + Refs #1162 Closes #1990 Closes #4168 diff --git a/doc/whatsnew/2/2.11/full.rst b/doc/whatsnew/2/2.11/full.rst index 470d5a5bcc..e26405a5cf 100644 --- a/doc/whatsnew/2/2.11/full.rst +++ b/doc/whatsnew/2/2.11/full.rst @@ -24,16 +24,13 @@ Release date: 2021-09-16 Closes #4776 - * Added ``py-version`` config key (if ``[MASTER]`` section). Used for version dependent checks. Will default to whatever Python version pylint is executed with. -* ``CodeStyleChecker`` - - * Added ``consider-using-assignment-expr``: Emitted when an assignment is directly followed by an if statement - and both can be combined by using an assignment expression ``:=``. Requires Python 3.8 +* ``CodeStyleChecker``: Added ``consider-using-assignment-expr``: Emitted when an assignment is directly followed by an if statement + and both can be combined by using an assignment expression ``:=``. Requires Python 3.8 - Closes #4862 + Closes #4862 * Added ``consider-using-f-string``: Emitted when .format() or '%' is being used to format a string. diff --git a/doc/whatsnew/2/2.11/summary.rst b/doc/whatsnew/2/2.11/summary.rst index b2135b7718..39851b0e85 100644 --- a/doc/whatsnew/2/2.11/summary.rst +++ b/doc/whatsnew/2/2.11/summary.rst @@ -52,12 +52,13 @@ Extensions Closes #4776 -* ``CodeStyleChecker`` +CodeStyleChecker +---------------- - * Added ``consider-using-assignment-expr``: Emitted when an assignment is directly followed by an if statement - and both can be combined by using an assignment expression ``:=``. Requires Python 3.8 +* Added ``consider-using-assignment-expr``: Emitted when an assignment is directly followed by an if statement + and both can be combined by using an assignment expression ``:=``. Requires Python 3.8 - Closes #4862 + Closes #4862 Other Changes diff --git a/doc/whatsnew/2/2.12/full.rst b/doc/whatsnew/2/2.12/full.rst index 3a873252b9..7421835db2 100644 --- a/doc/whatsnew/2/2.12/full.rst +++ b/doc/whatsnew/2/2.12/full.rst @@ -149,7 +149,7 @@ Release date: 2021-11-24 * ``undefined-variable`` and ``unused-variable`` now correctly trigger for assignment expressions in functions defaults - Fixes part of #3688 + Refs #3688 * ``undefined-variable`` now correctly triggers for assignment expressions in if ... else statements This includes a basic form of control flow inference for if ... else statements using @@ -276,7 +276,7 @@ Release date: 2021-11-24 * Fix crash on ``open()`` calls when the ``mode`` argument is not a simple string. - Partially closes #5321 + Fixes part of #5321 * Inheriting from a class that implements ``__class_getitem__`` no longer raises ``inherit-non-class``. diff --git a/doc/whatsnew/2/2.12/summary.rst b/doc/whatsnew/2/2.12/summary.rst index 61c3b87f2c..60099c6cda 100644 --- a/doc/whatsnew/2/2.12/summary.rst +++ b/doc/whatsnew/2/2.12/summary.rst @@ -35,11 +35,12 @@ New checkers Closes #3799 -* Checkers for ``typing.final`` +typing.final +------------ - * Added ``overridden-final-method``: Emitted when a method which is annotated with ``typing.final`` is overridden +* Added ``overridden-final-method``: Emitted when a method which is annotated with ``typing.final`` is overridden - * Added ``subclassed-final-class``: Emitted when a class which is annotated with ``typing.final`` is subclassed +* Added ``subclassed-final-class``: Emitted when a class which is annotated with ``typing.final`` is subclassed Closes #3197 @@ -161,7 +162,7 @@ Other Changes * ``undefined-variable`` and ``unused-variable`` now correctly trigger for assignment expressions in functions defaults - Fixes part of #3688 + Refs #3688 * ``self-cls-assignment`` now also considers tuple assignment @@ -231,7 +232,7 @@ Other Changes * Fix crash on ``open()`` calls when the ``mode`` argument is not a simple string. - Partially closes #5321 + Fixes part of #5321 * Add ability to add ``end_line`` and ``end_column`` to the ``--msg-template`` option. With the standard ``TextReporter`` this will add the line and column number of the diff --git a/doc/whatsnew/2/2.13/full.rst b/doc/whatsnew/2/2.13/full.rst index c5378222fc..5fd71c4664 100644 --- a/doc/whatsnew/2/2.13/full.rst +++ b/doc/whatsnew/2/2.13/full.rst @@ -16,7 +16,7 @@ Release date: 2022-05-13 * Fix ``IndexError`` crash in ``uninferable_final_decorators`` method. - Relates to #6531 + Refs #6531 * Fix a crash in ``unnecessary-dict-index-lookup`` when subscripting an attribute. @@ -201,11 +201,11 @@ Release date: 2022-03-27 * Fix a false negative regression in 2.13.0 where ``protected-access`` was not raised on functions. - Fixes #5989 + Closes #5989 * Better error messages in case of crash if pylint can't write the issue template. - Refer to #5987 + Refs #5987 What's New in Pylint 2.13.1? @@ -215,7 +215,7 @@ Release date: 2022-03-26 * Fix a regression in 2.13.0 where ``used-before-assignment`` was emitted for the usage of a nonlocal in a try block. - Fixes #5965 + Closes #5965 * Avoid emitting ``raising-bad-type`` when there is inference ambiguity on the variable being raised. @@ -250,7 +250,7 @@ Release date: 2022-03-24 * No longer emit ``no-member`` in for loops that reference ``self`` if the binary operation that started the for loop uses a ``self`` that is encapsulated in tuples or lists. - Ref PyCQA/astroid#1360 + Refs PyCQA/astroid#1360 Closes #4826 * Output better error message if unsupported file formats are used with ``pyreverse``. @@ -296,7 +296,7 @@ Release date: 2022-03-24 * Fix false-negative for ``assignment-from-none`` checker using list.sort() method. - closes #5722 + Closes #5722 * New extension ``import-private-name``: indicate imports of external private packages and objects (prefixed with ``_``). It can be loaded using ``load-plugins=pylint.extensions.private_import``. @@ -328,7 +328,7 @@ Release date: 2022-03-24 * Fixed an issue where ``ungrouped-imports`` could not be disabled without raising ``useless-suppression``. - Ref #2366 + Refs #2366 * Added several checkers to deal with unicode security issues (see `Trojan Sources `_ and @@ -354,15 +354,15 @@ Release date: 2022-03-24 * Use the ``tomli`` package instead of ``toml`` to parse ``.toml`` files. - Closes #5885 + Closes #5885 * Fix false positive - Allow unpacking of ``self`` in a subclass of ``typing.NamedTuple``. - Closes #5312 + Closes #5312 * Fixed false negative ``unpacking-non-sequence`` when value is an empty list. - Closes #5707 + Closes #5707 * Better warning messages for useless else or elif when a function returns early. @@ -649,7 +649,7 @@ Release date: 2022-03-24 * Fix false positive ``not-callable`` with attributes that alias ``NamedTuple`` - Partially closes #1730 + Fixes part of #1730 * Emit ``redefined-outer-name`` when a nested except handler shadows an outer one. @@ -750,6 +750,7 @@ Release date: 2022-03-24 Closes #4955 * Disable spellchecking of mypy rule names in ignore directives. + Closes #5929 * Allow disabling ``duplicate-code`` with a disable comment when running through diff --git a/doc/whatsnew/2/2.13/summary.rst b/doc/whatsnew/2/2.13/summary.rst index 35141d5b4d..8305285911 100644 --- a/doc/whatsnew/2/2.13/summary.rst +++ b/doc/whatsnew/2/2.13/summary.rst @@ -122,7 +122,7 @@ Extensions * Disable checker ``bad-docstring-quotes`` for Python <= 3.7, because in these versions the line numbers for decorated functions and classes are not reliable which interferes with the checker. - Closes #3077 + Closes #3077 Other Changes ============= @@ -144,7 +144,7 @@ Other Changes * No longer emit ``no-member`` in for loops that reference ``self`` if the binary operation that started the for loop uses a ``self`` that is encapsulated in tuples or lists. - Ref PyCQA/astroid#1360 + Refs PyCQA/astroid#1360 Closes #4826 * Fix matching ``--notes`` options that end in a non-word character. @@ -210,7 +210,7 @@ Other Changes * Use the ``tomli`` package instead of ``toml`` to parse ``.toml`` files. - Closes #5885 + Closes #5885 * Fixed false positive ``consider-using-dict-comprehension`` when creating a dict using a list of tuples where key AND value vary depending on the same condition. @@ -269,7 +269,7 @@ Other Changes * Fixed an issue where ``ungrouped-imports`` could not be disabled without raising ``useless-suppression``. - Ref #2366 + Refs #2366 * Fixed a crash on ``__init__`` nodes when the attribute was previously uninferable due to a cache limit size. This limit can be hit when the inheritance pattern of a class (and therefore of the ``__init__`` attribute) is very large. @@ -295,13 +295,13 @@ Other Changes the class itself. Closes #5408 - Ref PyCQA/astroid#1392 + RefsPyCQA/astroid#1392 * Fixed false positive for ``unused-argument`` when a method overridden in a subclass does nothing with the value of a keyword-only argument. Closes #5771 - Ref PyCQA/astroid#1382 + RefsPyCQA/astroid#1382 * Optimize parsing of long lines when ``missing-final-newline`` is enabled. @@ -343,7 +343,7 @@ Other Changes * Fixed a crash involving a ``NewType`` named with an f-string. Closes #5770 - Ref PyCQA/astroid#1400 + RefsPyCQA/astroid#1400 * Improved ``bad-open-mode`` message when providing ``None`` to the ``mode`` argument of an ``open()`` call. @@ -510,7 +510,7 @@ Other Changes * Fix false positive ``not-callable`` with attributes that alias ``NamedTuple`` - Partially closes #1730 + Fixes part of #1730 * The ``testutils`` for unittests now accept ``end_lineno`` and ``end_column``. Tests without these will trigger a ``DeprecationWarning``. @@ -649,7 +649,7 @@ Other Changes * Fix ``IndexError`` crash in ``uninferable_final_decorators`` method. - Relates to #6531 + Refs #6531 * Fix a crash in ``unnecessary-dict-index-lookup`` when subscripting an attribute. diff --git a/doc/whatsnew/2/2.14/full.rst b/doc/whatsnew/2/2.14/full.rst index 7b74468c4a..ad2335afdc 100644 --- a/doc/whatsnew/2/2.14/full.rst +++ b/doc/whatsnew/2/2.14/full.rst @@ -27,12 +27,12 @@ Release date: TBA * ``pylint.pyreverse.ASTWalker`` has been removed, as it was only used internally by a single child class. - Ref #6712 + Refs #6712 * ``pyreverse``: Resolving and displaying implemented interfaces that are defined by the ``__implements__`` attribute has been deprecated and will be removed in 3.0. - Ref #6713 + Refs #6713 * Fix syntax for return type annotations in MermaidJS diagrams produced with ``pyreverse``. @@ -107,20 +107,20 @@ Release date: TBA * The ``config`` attribute of ``BaseChecker`` has been deprecated. You can use ``checker.linter.config`` to access the global configuration object instead of a checker-specific object. - Ref #5392 + Refs #5392 * The ``level`` attribute of ``BaseChecker`` has been deprecated: everything is now displayed in ``--help``, all the time. - Ref #5392 + Refs #5392 * The ``options_providers`` attribute of ``ArgumentsManager`` has been deprecated. - Ref #5392 + Refs #5392 * The ``option_groups`` attribute of ``PyLinter`` has been deprecated. - Ref #5392 + Refs #5392 * All ``Interface`` classes in ``pylint.interfaces`` have been deprecated. You can subclass the respective normal classes to get the same behaviour. The ``__implements__`` functionality @@ -132,7 +132,7 @@ Release date: TBA * The ``set_option`` method of ``BaseChecker`` has been deprecated. You can use ``checker.linter.set_option`` to set an option on the global configuration object instead of a checker-specific object. - Ref #5392 + Refs #5392 * ``implicit-str-concat`` will now be raised on calls like ``open("myfile.txt" "a+b")`` too. @@ -141,7 +141,7 @@ Release date: TBA * The ``config`` attribute of ``PyLinter`` is now of the ``argparse.Namespace`` type instead of ``optparse.Values``. - Ref #5392 + Refs #5392 * ``MapReduceMixin`` has been deprecated. ``BaseChecker`` now implements ``get_map_data`` and ``reduce_map_data``. If a checker actually needs to reduce data it should define ``get_map_data`` @@ -151,49 +151,49 @@ Release date: TBA * ``UnsupportedAction`` has been deprecated. - Ref #5392 + Refs #5392 * ``OptionsManagerMixIn`` has been deprecated. - Ref #5392 + Refs #5392 * ``OptionParser`` has been deprecated. - Ref #5392 + Refs #5392 * ``Option`` has been deprecated. - Ref #5392 + Refs #5392 * ``OptionsProviderMixIn`` has been deprecated. - Ref #5392 + Refs #5392 * ``ConfigurationMixIn`` has been deprecated. - Ref #5392 + Refs #5392 * ``get_global_config`` has been deprecated. You can now access all global options from ``checker.linter.config``. - Ref #5392 + Refs #5392 * ``OptionsManagerMixIn`` has been replaced with ``ArgumentsManager``. ``ArgumentsManager`` is considered private API and most methods that were public on ``OptionsManagerMixIn`` have now been deprecated and will be removed in a future release. - Ref #5392 + Refs #5392 * ``OptionsProviderMixIn`` has been replaced with ``ArgumentsProvider``. ``ArgumentsProvider`` is considered private API and most methods that were public on ``OptionsProviderMixIn`` have now been deprecated and will be removed in a future release. - Ref #5392 + Refs #5392 * ``interfaces.implements`` has been deprecated and will be removed in 3.0. Please use standard inheritance patterns instead of ``__implements__``. - Ref #2287 + Refs #2287 * ``invalid-enum-extension``: Used when a class tries to extend an inherited Enum class. @@ -276,7 +276,7 @@ Release date: TBA * Added the ``generate-toml-config`` option. - Ref #5462 + Refs #5462 * Added new checker ``unnecessary-list-index-lookup`` for indexing into a list while iterating over ``enumerate()``. @@ -316,7 +316,7 @@ Release date: TBA ``import-graph``, ``ext-import-graph``, ``int-import-graph`` options, and the spell checker's ``spelling-private-dict-file`` option. - Relates to #6493 + Refs #6493 * Created ``NoSelfUseChecker`` extension and moved the ``no-self-use`` check. You now need to explicitly enable this check using @@ -336,7 +336,7 @@ Release date: TBA * Fix pyreverse crash ``RuntimeError: dictionary changed size during iteration`` - Relates to #6612 + Refs #6612 * Fix bug where it writes a plain text error message to stdout, invalidating output formats. @@ -346,7 +346,7 @@ Release date: TBA Use ``is_postponed_evaluation_enabled(node) and is_node_in_type_annotation_context(node)`` instead. - Ref #6536 + Refs #6536 * Update ranges for ``using-constant-test`` and ``missing-parentheses-for-call-in-test`` error messages. diff --git a/doc/whatsnew/2/2.14/summary.rst b/doc/whatsnew/2/2.14/summary.rst index 8a0ad571ff..54f10a4fe9 100644 --- a/doc/whatsnew/2/2.14/summary.rst +++ b/doc/whatsnew/2/2.14/summary.rst @@ -104,19 +104,19 @@ Extensions * Added optional extension ``redefined-loop-name`` to emit messages when a loop variable is redefined in the loop body. - Closes #5072 + Closes #5072 * ``DocStringStyleChecker`` * Re-enable checker ``bad-docstring-quotes`` for Python <= 3.7. - Closes #6087 + Closes #6087 * ``NoSelfUseChecker`` * Added ``no-self-use`` check, previously enabled by default. - Closes #5502 + Closes #5502 Other Changes @@ -191,7 +191,7 @@ Other Changes * Added the ``generate-toml-config`` option. - Ref #5462 + Refs #5462 * ``bad-option-value`` will be emitted whenever a configuration value or command line invocation includes an unknown message. @@ -249,7 +249,7 @@ Other Changes ``import-graph``, ``ext-import-graph``, ``int-import-graph`` options, and the spell checker's ``spelling-private-dict-file`` option. - Relates to #6493 + Refs #6493 * Don't emit ``unsubscriptable-object`` for string annotations. Pylint doesn't check if class is only generic in type stubs only. @@ -258,7 +258,7 @@ Other Changes * Fix pyreverse crash ``RuntimeError: dictionary changed size during iteration`` - Relates to #6612 + Refs #6612 * Fix syntax for return type annotations in MermaidJS diagrams produced with ``pyreverse``. @@ -299,7 +299,7 @@ Deprecations * ``interfaces.implements`` has been deprecated and will be removed in 3.0. Please use standard inheritance patterns instead of ``__implements__``. - Ref #2287 + Refs #2287 * All ``Interface`` classes in ``pylint.interfaces`` have been deprecated. You can subclass the respective normal classes to get the same behaviour. The ``__implements__`` functionality @@ -318,21 +318,21 @@ Deprecations * The ``config`` attribute of ``BaseChecker`` has been deprecated. You can use ``checker.linter.config`` to access the global configuration object instead of a checker-specific object. - Ref #5392 + Refs #5392 * The ``level`` attribute of ``BaseChecker`` has been deprecated: everything is now displayed in ``--help``, all the time. - Ref #5392 + Refs #5392 * The ``set_option`` method of ``BaseChecker`` has been deprecated. You can use ``checker.linter.set_option`` to set an option on the global configuration object instead of a checker-specific object. - Ref #5392 + Refs #5392 * The ``options_providers`` attribute of ``ArgumentsManager`` has been deprecated. - Ref #5392 + Refs #5392 * Fix saving of persistent data files in environments where the user's cache directory and the linted file are on a different drive. @@ -344,62 +344,62 @@ Deprecations * The ``config`` attribute of ``PyLinter`` is now of the ``argparse.Namespace`` type instead of ``optparse.Values``. - Ref #5392 + Refs #5392 * ``UnsupportedAction`` has been deprecated. - Ref #5392 + Refs #5392 * ``OptionsManagerMixIn`` has been deprecated. - Ref #5392 + Refs #5392 * ``OptionParser`` has been deprecated. - Ref #5392 + Refs #5392 * ``Option`` has been deprecated. - Ref #5392 + Refs #5392 * ``OptionsProviderMixIn`` has been deprecated. - Ref #5392 + Refs #5392 * ``ConfigurationMixIn`` has been deprecated. * The ``option_groups`` attribute of ``PyLinter`` has been deprecated. - Ref #5392 + Refs #5392 * ``get_global_config`` has been deprecated. You can now access all global options from ``checker.linter.config``. - Ref #5392 + Refs #5392 * ``OptionsManagerMixIn`` has been replaced with ``ArgumentsManager``. ``ArgumentsManager`` is considered private API and most methods that were public on ``OptionsManagerMixIn`` have now been deprecated and will be removed in a future release. - Ref #5392 + Refs #5392 * ``OptionsProviderMixIn`` has been replaced with ``ArgumentsProvider``. ``ArgumentsProvider`` is considered private API and most methods that were public on ``OptionsProviderMixIn`` have now been deprecated and will be removed in a future release. - Ref #5392 + Refs #5392 * ``pylint.pyreverse.ASTWalker`` has been removed, as it was only used internally by a single child class. - Ref #6712 + Refs #6712 * ``pyreverse``: Resolving and displaying implemented interfaces that are defined by the ``__implements__`` attribute has been deprecated and will be removed in 3.0. - Ref #6713 + Refs #6713 * ``is_class_subscriptable_pep585_with_postponed_evaluation_enabled`` has been deprecated. Use ``is_postponed_evaluation_enabled(node) and is_node_in_type_annotation_context(node)`` instead. - Ref #6536 + Refs #6536 diff --git a/doc/whatsnew/2/2.2/full.rst b/doc/whatsnew/2/2.2/full.rst index 4eeafdf8c5..daa906d8c7 100644 --- a/doc/whatsnew/2/2.2/full.rst +++ b/doc/whatsnew/2/2.2/full.rst @@ -32,7 +32,7 @@ Release date: 2018-11-25 * Consider ``range()`` objects for ``undefined-loop-variable`` leaking from iteration. - Close #2533 + Closes #2533 * ``deprecated-method`` can use the attribute name for identifying a deprecated method @@ -41,18 +41,18 @@ Release date: 2018-11-25 deprecation function. Instead on relying on that, we now also rely on the attribute name, which should solve some false positives. - Close #1653 - Close #1946 + Closes #1653 + Closes #1946 * Fix compatibility with changes to stdlib tokenizer. * ``pylint`` is less eager to consume the whole line for pragmas - Close #2485 + Closes #2485 * Obtain the correct number of CPUs for virtualized or containerized environments. - Close #2519 + Closes #2519 * Change ``unbalanced-tuple-unpacking`` back to a warning. @@ -62,101 +62,103 @@ Release date: 2018-11-25 analysis time. Given it might rely on potential unknown data, it's best to have it as a warning. - Close #2522 + Closes #2522 * Remove ``enumerate`` usage suggestion when defining ``__iter__`` (C0200) - Close #2477 + Closes #2477 * Emit ``too-many-starred-assignment`` only when the number of Starred nodes is per assignment elements - Close #2513 + Closes #2513 * ``try-except-raise`` checker now handles multilevel inheritance hirerachy for exceptions correctly. - Close #2484 + Closes #2484 * Add a new check, ``simplifiable-if-expression`` for expressions like ``True if cond else False``. - Close #2487 + Closes #2487 * ``too-few-public-methods`` is not reported for ``typing.NamedTuple`` - Close #2459 + Closes #2459 * ```too-few-public-methods`` is not reported for dataclasses created with options. - Close #2488 + Closes #2488 * Remove wrong modules from 'bad-python3-import'. - Close #2453 + Closes #2453 * The ``json`` reporter prints an empty list when no messages are emitted - Close #2446 + Closes #2446 * Add a new check, ``duplicate-string-formatting-argument`` This new check is emitted whenever a duplicate string formatting argument is found. - Close #497 + Closes #497 * ``assignment-from-no-return`` is not emitted for coroutines. - Close #1715 + Closes #1715 * Report format string type mismatches. * ``consider-using-ternary`` and ``simplified-boolean-expression`` no longer emit for sequence based checks - Close #2473 + Closes #2473 * Handle ``AstroidSyntaxError`` when trying to import a module. - Close #2313 + Closes #2313 -* Allow ``__module__`` to be redefined at a class level. Close #2451 +* Allow ``__module__`` to be redefined at a class level. + + Closes #2451 * ``pylint`` used to emit an ``unused-variable`` error if unused import was found in the function. Now instead of ``unused-variable``, ``unused-import`` is emitted. - Close #2421 + Closes #2421 * Handle asyncio.coroutine when looking for ``not-an-iterable`` check. - Close #996 + Closes #996 * The ``locally-enabled`` check is gone. - Close #2442 + Closes #2442 * Infer decorated methods when looking for method-hidden - Close #2369 + Closes #2369 * Pick the latest value from the inferred values when looking for ``raising-non-exception`` - Close #2431 + Closes #2431 * Extend the TYPE_CHECKING guard to TYPE_CHECKING name as well, not just the attribute - Close #2411 + Closes #2411 * Ignore import x.y.z as z cases for checker ``useless-import-alias``. - Close #2309 + Closes #2309 * Fix false positive ``undefined-variable`` and ``used-before-assignment`` with nonlocal keyword usage. - Close #2049 + Closes #2049 * Stop ``protected-access`` exception for missing class attributes * Don't emit ``assignment-from-no-return`` for decorated function nodes - Close #2385 + Closes #2385 * ``unnecessary-pass`` is now also emitted when a function or class contains only docstring and pass statement. @@ -164,19 +166,19 @@ Release date: 2018-11-25 indicating that the function doesn't do anything. However, a stubbed function can also have just a docstring, and function with a docstring and no body also does nothing. - Close #2208 + Closes #2208 * ``duplicate-argument-name`` is emitted for more than one duplicate argument per function - Close #1712 + Closes #1712 * Allow double indentation levels for more distinguishable indentations - Close #741 + Closes #741 * Consider tuples in exception handler for ``try-except-raise``. - Close #2389 + Closes #2389 * Fix astroid.ClassDef check in checkers.utils.is_subclass_of @@ -186,14 +188,14 @@ Release date: 2018-11-25 * Fix wildcard import check not skipping ``__init__.py`` - Close #2430 + Closes #2430 * Add new option to logging checker, ``logging_format_style`` * Fix --ignore-imports to understand multi-line imports - Close #1422 - Close #2019 + Closes #1422 + Closes #2019 * Add a new check 'implicit-str-concat-in-sequence' to spot string concatenation inside lists, sets & tuples. diff --git a/doc/whatsnew/2/2.2/summary.rst b/doc/whatsnew/2/2.2/summary.rst index b812c4771b..3e27077729 100644 --- a/doc/whatsnew/2/2.2/summary.rst +++ b/doc/whatsnew/2/2.2/summary.rst @@ -33,7 +33,7 @@ Other Changes * ``try-except-raise`` checker now handles multilevel inheritance hirerachy for exceptions correctly. - Close #2484 + Closes #2484 * Ignore import x.y.z as z cases for checker ``useless-import-alias``. @@ -49,14 +49,14 @@ Other Changes for multiple types, since ``pylint`` was picking just the first inferred value, leading to spurious false positives. - Close #2431 + Closes #2431 * ``pylint`` used to emit a ``not-an-iterable`` error when looking at coroutines built with ``asyncio.coroutine``. This is no longer the case as we handle coroutines explicitly. - Close #996 + Closes #996 * ``pylint`` used to emit an ``unused-variable`` error if unused import was found in the function. Now instead of ``unused-variable``, ``unused-import`` is emitted. - Close #2421 + Closes #2421 diff --git a/doc/whatsnew/2/2.3/full.rst b/doc/whatsnew/2/2.3/full.rst index 4e77f5ef30..d55021275d 100644 --- a/doc/whatsnew/2/2.3/full.rst +++ b/doc/whatsnew/2/2.3/full.rst @@ -13,41 +13,41 @@ Release date: 2019-02-27 Doesn't make that much sense for ``pylint`` itself, which is why we're handling the exception here, rather than in ``astroid`` - Close PyCQA/astroid#644 + Closes PyCQA/astroid#644 * Added a new command line option ``list-groups`` for listing all the check groups ``pylint`` knows about. * Allow ``BaseException`` for emitting ``broad-except``, just like ``Exception``. - Close #2741 + Closes #2741 * Fixed a crash that occurred for ``bad-str-strip-call`` when ``strip()`` received ``None`` - Close #2743 + Closes #2743 * Don't emit ``*-not-iterating`` checks for builtins consumed by ``itertools`` - Close #2731 + Closes #2731 * Fix a crash caused by iterating over ``Uninferable`` in a string formatting check. - Close #2727 + Closes #2727 * Fixed false positives for ``no-self-argument`` and ``unsubscriptable-object`` when using ``__class_getitem__`` (new in Python 3.7) - Close #2416 + Closes #2416 * Support ``Ellipsis`` as a synonym for ``pass`` statements. - Close #2718 + Closes #2718 * ``fixme`` gets triggered only on comments. - Close #2321 + Closes #2321 * Fixed a false positive for ``unused-variable`` and ``nonlocal`` assignments - Close #2671 + Closes #2671 * Added ``load_configuration()`` hook for plugins @@ -56,27 +56,27 @@ Release date: 2019-02-27 overwriting plugin specific configuration via user-based configuration. - Close #2635 + Closes #2635 * Fix missing-raises-doc false positive (W9006) - Close #1502 + Closes #1502 * Exempt starred unpacking from ``*-not-iterating`` Python 3 checks - Close #2651 + Closes #2651 * Make ``compare-to-zero`` less zealous by checking against equality and identity - Close #2645 + Closes #2645 * Add ``no-else-raise`` warning (R1720) - Close #2558 + Closes #2558 * Exempt ``yield from`` from ``*-not-iterating`` Python 3 checks. - Close #2643 + Closes #2643 * Fix incorrect generation of ``no-else-return`` warnings (R1705) @@ -88,7 +88,7 @@ Release date: 2019-02-27 * Fix false positive with ``not-async-context-manager`` caused by not understanding ``contextlib.asynccontextmanager`` - Close #2440 + Closes #2440 * Refactor ``bad-reversed-sequence`` to account for more objects that can define ``__reversed__`` @@ -96,7 +96,7 @@ Release date: 2019-02-27 As such, the check for ``bad-reversed-sequence`` needs to not differentiate between classes and instances when it comes for checking of ``__reversed__`` presence. - Close #2598 + Closes #2598 * Added ``wrong-exception-operation`` @@ -104,7 +104,7 @@ Release date: 2019-02-27 is not valid for the exception in question. Usually emitted when having binary operations between exceptions in except handlers. - Close #2494 + Closes #2494 * ``no-member`` is emitted for enums when they lack a member @@ -114,7 +114,7 @@ Release date: 2019-02-27 but that is fine for Enums, given that they are inferred in a customised way in astroid. - Close #2565 + Closes #2565 * Generalize ``chained-comparison`` @@ -123,7 +123,7 @@ Release date: 2019-02-27 * Avoid popping __main__ when using multiple jobs - Close #2689 + Closes #2689 * Add a new option 'check-str-concat-over-line-jumps' to check 'implicit-str-concat-in-sequence' diff --git a/doc/whatsnew/2/2.4/full.rst b/doc/whatsnew/2/2.4/full.rst index b6ba78fa4d..079e37707b 100644 --- a/doc/whatsnew/2/2.4/full.rst +++ b/doc/whatsnew/2/2.4/full.rst @@ -11,11 +11,11 @@ Release date: 2019-11-13 exempted, but we need to do that for the rest of the type comment names as well. - Close #3112 + Closes #3112 * Relax type import detection for names that do not come from the ``typing`` module - Close #3191 + Closes #3191 What's New in Pylint 2.4.3? @@ -24,23 +24,23 @@ Release date: 2019-10-18 * Fix an issue with ``unnecessary-comprehension`` in comprehensions with additional repacking of elements. - Close #3148 + Closes #3148 * ``import-outside-toplevel`` is emitted for ``ImportFrom`` nodes as well. - Close #3175 + Closes #3175 * Do not emit ``no-method-argument`` for functions using positional only args. - Close #3161 + Closes #3161 * ``consider-using-sys-exit`` is no longer emitted when ``exit`` is imported in the local scope. - Close #3147 + Closes #3147 * ``invalid-overridden-method`` takes ``abc.abstractproperty`` in account - Close #3150 + Closes #3150 * Fixed ``missing-yield-type-doc`` getting incorrectly raised when a generator does not document a yield type but has a type annotation. @@ -49,7 +49,7 @@ Release date: 2019-10-18 * ``typing.overload`` functions are exempted from ``too-many-function-args`` - Close #3170 + Closes #3170 What's New in Pylint 2.4.2? @@ -57,19 +57,21 @@ What's New in Pylint 2.4.2? Release date: 2019-09-30 -* ``ignored-modules`` can skip submodules. Close #3135 +* ``ignored-modules`` can skip submodules. + + Closes #3135 * ``self-assigning-variable`` skips class level assignments. - Close #2930 + Closes #2930 * ``consider-using-sys-exit`` is exempted when ``exit()`` is imported from ``sys`` - Close #3145 + Closes #3145 * Exempt annotated assignments without variable from ``class-variable-slots-conflict`` - Close #3141 + Closes #3141 * Fix ``utils.is_error`` to account for functions returning early. @@ -77,7 +79,7 @@ Release date: 2019-09-30 when a function raised an exception as the last instruction, but the body of the function still had unused variables. - Close #3028 + Closes #3028 What's New in Pylint 2.4.1? @@ -87,7 +89,7 @@ Release date: 2019-09-25 * Exempt type checking definitions defined in both clauses of a type checking guard - Close #3127 + Closes #3127 * Exempt type checking definitions inside the type check guard @@ -98,7 +100,7 @@ Release date: 2019-09-25 Unfortunately that missed the case of using those type checking imports inside the guard itself, which triggered spurious used-before-assignment errors. - Close #3119 + Closes #3119 * Require astroid >= 2.3 to avoid any compatibility issues. @@ -114,43 +116,43 @@ Release date: 2019-09-24 * Handle inference ambiguity for ``invalid-format-index`` - Close #2752 + Closes #2752 * Removed Python 2 specific checks such as ``relative-import``, ``invalid-encoded-data``, ``missing-super-argument``. * Support forward references for ``function-redefined`` check. - Close #2540 + Closes #2540 * Handle redefinitions in case of type checking imports. - Close #2834 + Closes #2834 * Added a new check, ``consider-using-sys-exit`` This check is emitted when we detect that a quit() or exit() is invoked instead of sys.exit(), which is the preferred way of exiting in program. - Close #2925 + Closes #2925 * ``useless-suppression`` check now ignores ``cyclic-import`` suppressions, which could lead to false postiives due to incomplete context at the time of the check. - Close #3064 + Closes #3064 * Added new checks, ``no-else-break`` and ``no-else-continue`` These checks highlight unnecessary ``else`` and ``elif`` blocks after ``break`` and ``continue`` statements. - Close #2327 + Closes #2327 * Don't emit ``protected-access`` when a single underscore prefixed attribute is used inside a special method - Close #1802 + Closes #1802 * Fix the "statement" values in the PyLinter's stats reports by module. @@ -160,7 +162,7 @@ Release date: 2019-09-24 as a property or a property is overridden as a method. This can indicate a bug in the application code that will trigger a runtime error. - Close #2670 + Closes #2670 * Added a new check, ``arguments-out-of-order`` @@ -168,14 +170,15 @@ Release date: 2019-09-24 a function's signature but you are passing them in to the function in a different order. - Close #2975 + Closes #2975 * Added a new check, ``redeclared-assigned-name`` This check is emitted when ``pylint`` detects that a name was assigned one or multiple times in the same assignment, which indicate a potential bug. - Close #2898 + + Closes #2898 * Ignore lambda calls with variadic arguments without a context. @@ -187,60 +190,67 @@ Release date: 2019-09-24 We already did that for function calls, but the previous fix was not taking in consideration ``lambdas`` - Close #2918 + Closes #2918 -* Added a new check, ``self-assigning-variable`` +* Added a new check, ``self-assigning-variable``. This check is emitted + when we detect that a variable is assigned to itself, which might + indicate a potential bug in the code application. - This check is emitted when we detect that a variable is assigned - to itself, which might indicate a potential bug in the code application. - Close #2930 + Closes #2930 * Added a new check, ``property-with-parameters``. This check is emitted when we detect that a defined property also has parameters, which are useless. - Close #3006 -* Excluded protocol classes from a couple of checks. Close #3002. + Closes #3006 + +* Excluded protocol classes from a couple of checks. + + Closes #3002. * Add a check ``unnecessary-comprehension`` that detects unnecessary comprehensions. This check is emitted when ``pylint`` finds list-, set- or dict-comprehensions, that are unnecessary and can be rewritten with the list-, set- or dict-constructors. - Close #2905 + Closes #2905 -* Excluded PEP 526 instance and class variables from ``no-member``. Close #2945 +* Excluded PEP 526 instance and class variables from ``no-member``. -* Excluded ``attrs`` from ``too-few-public-methods`` check. Close #2988. + Closes #2945 + +* Excluded ``attrs`` from ``too-few-public-methods`` check. + + Closes #2988. * ``unused-import`` emitted for the right import names in function scopes. - Close #2928 + Closes #2928 * Dropped support for Python 3.4. * ``assignment-from-no-return`` not triggered for async methods. - Close #2902 + Closes #2902 * Don't emit ``attribute-defined-outside-init`` for variables defined in setters. - Close #409 + Closes #409 * Syntax errors report the column number. - Close #2914 + Closes #2914 * Support fully qualified typing imports for type annotations. - Close #2915 + Closes #2915 * Exclude ``__dict__`` from ``attribute-defined-outside-init`` * Fix pointer on spelling check when the error are more than one time in the same line. - Close #2895 + Closes #2895 * Fix crash happening when parent of called object cannot be determined @@ -248,37 +258,37 @@ Release date: 2019-09-24 * Added ``subprocess-run-check`` to handle subrocess.run without explicitly set ``check`` keyword. - Close #2848 + Closes #2848 * When we can't infer bare except handlers, skip ``try-except-raise`` - Close #2853 + Closes #2853 * Handle more ``unnecessary-lambda`` cases when dealing with additional kwargs in wrapped calls - Close #2845 + Closes #2845 * Better postponed evaluation of annotations handling - Close #2847 + Closes #2847 * Support postponed evaluation of annotations for variable annotations. - Close #2838 + Closes #2838 * ``epylint.py_run`` defaults to ``python`` in case the current executable is not a Python one. - Close #2837 + Closes #2837 * Ignore raw docstrings when running Similarities checker with ``ignore-docstrings=yes`` option * Fix crash when calling ``inherit_from_std_ex`` on a class which is its own ancestor - Close #2680 + Closes #2680 * Added a new check that warns the user if a function call is used inside a test but parentheses are missing. - Close #2658 + Closes #2658 * ``len-as-condition`` now only fires when a ``len(x)`` call is made without an explicit comparison @@ -286,7 +296,7 @@ Release date: 2019-09-24 reflect this new behavior, by explicitly asking to either rely on the fact that empty sequence are false or to compare the length with a scalar. - Close #2684 + Closes #2684 * Add ``preferred-module`` checker that notify if an import has a replacement module that should be used. @@ -295,21 +305,21 @@ Release date: 2019-09-24 * ``assigning-non-slot`` not emitted for classes with unknown base classes. - Close #2807 + Closes #2807 * ``old-division`` is not emitted for non-Const nodes. - Close #2808 + Closes #2808 * Added method arguments to the dot writer for pyreverse. - Close #2139 + Closes #2139 * Support for linting file from stdin. IDEs may benefit from the support for linting from an in-memory file. - Close #1187 + Closes #1187 * Added a new check ``class-variable-slots-conflict`` @@ -318,66 +328,66 @@ Release date: 2019-09-24 * Added new check: dict-iter-missing-items (E1141) - Close #2761 + Closes #2761 * Fix issue with pylint name in output of python -m pylint --version - Close #2764 + Closes #2764 * Relicense logo material under the CC BY-SA 4.0 license. * Skip ``if`` expressions from f-strings for the ``check_elif`` checker - Close #2816 + Closes #2816 * C0412 (ungrouped-import) is now compatible with isort. - Close #2806 + Closes #2806 * Added new extension to detect too much code in a try clause - Close #2877 + Closes #2877 -* ``signature-mutators`` option was added +* ``signature-mutators`` option was added. + With this option, users can choose to ignore ``too-many-function-args``, ``unexpected-keyword-arg``, + and ``no-value-for-parameter`` for functions decorated with decorators that change + the signature of a decorated function. - With this option, users can choose to ignore ``too-many-function-args``, ``unexpected-keyword-arg``, - and ``no-value-for-parameter`` for functions decorated with decorators that change - the signature of a decorated function. - - Close #259 + Closes #259 * Fixed a pragma comment on its own physical line being ignored when part of a logical line with the previous physical line. - Close #199 + Closes #199 * Fixed false ``undefined-loop-variable`` for a function defined in the loop, that uses the variable defined in that loop. - Close #202 + Closes #202 * Fixed ``unused-argument`` and ``function-redefined`` getting raised for functions decorated with ``typing.overload``. - Close #1581 + Closes #1581 * Fixed a false positive with ``consider-using-dict-comprehension`` for constructions that can't be converted to a comprehension - Close #2963 + Closes #2963 * Added ``__post_init__`` to ``defining-attr-methods`` in order to avoid ``attribute-defined-outside-init`` in dataclasses. - Close #2581 + Closes #2581 * Changed description of W0199 to use the term 2-item-tuple instead of 2-uple. * Allow a ``.`` as a prefix for Sphinx name resolution. * Checkers must now keep a 1 to 1 relationship between "msgid" (ie: C1234) and "symbol" (i.e. : human-readable-symbol) + * In checkers, an old_names can now be used for multiple new messages and pylint is now a little faster -Caused by #1164. It means if you do a partial old_names for a message definition an exception will tell you that you -must rename the associated identification. + It means if you do a partial old_names for a message definition an exception will tell you that you + must rename the associated identification. * Allow the choice of f-strings as a valid way of formatting logging strings. diff --git a/doc/whatsnew/2/2.4/summary.rst b/doc/whatsnew/2/2.4/summary.rst index 81e67f5437..2793553948 100644 --- a/doc/whatsnew/2/2.4/summary.rst +++ b/doc/whatsnew/2/2.4/summary.rst @@ -19,7 +19,7 @@ New checkers This check is emitted when we detect that a quit() or exit() is invoked instead of sys.exit(), which is the preferred way of exiting in program. - Close #2925 + Closes #2925 * Added a new check, ``arguments-out-of-order`` @@ -27,21 +27,21 @@ New checkers a function's signature but you are passing them in to the function in a different order. - Close #2975 + Closes #2975 * Added new checks, ``no-else-break`` and ``no-else-continue`` These checks highlight unnecessary ``else`` and ``elif`` blocks after ``break`` and ``continue`` statements. - Close #2327 + Closes #2327 * Added ``unnecessary-comprehension`` that detects unnecessary comprehensions. This check is emitted when ``pylint`` finds list-, set- or dict-comprehensions, that are unnecessary and can be rewritten with the list-, set- or dict-constructors. - Close #2905 + Closes #2905 * Added a new check, ``invalid-overridden-method`` @@ -49,14 +49,14 @@ New checkers as a property or a property is overridden as a method. This can indicate a bug in the application code that will trigger a runtime error. - Close #2670 + Closes #2670 * Added a new check, ``redeclared-assigned-name`` This check is emitted when ``pylint`` detects that a name was assigned one or multiple times in the same assignment, which indicate a potential bug. - Close #2898 + Closes #2898 * Added a new check, ``self-assigning-variable`` @@ -72,16 +72,16 @@ New checkers attr = attr return a_inst - Close #2930 + Closes #2930 * Added a new check ``property-with-parameters`` which detects when a property has more than a single argument. - Close #3006 + Closes #3006 * Added ``subprocess-run-check`` to handle subprocess.run without explicitly set ``check`` keyword. - Close #2848 + Closes #2848 * We added a new check message ``dict-iter-missing-items``. This is emitted when trying to iterate through a dict in a for loop without calling its .items() method. @@ -129,7 +129,7 @@ Other Changes * Don't emit ``protected-access`` when a single underscore prefixed attribute is used inside a special method - Close #1802 + Closes #1802 * ``len-as-condition`` now only fires when a ``len(x)`` call is made without an explicit comparison. diff --git a/doc/whatsnew/2/2.5/full.rst b/doc/whatsnew/2/2.5/full.rst index 3ae95c79ce..06d61f7e48 100644 --- a/doc/whatsnew/2/2.5/full.rst +++ b/doc/whatsnew/2/2.5/full.rst @@ -7,19 +7,19 @@ Release date: 2020-06-8 * Fix a regression where disable comments that have checker names with numbers in them are not parsed correctly - Close #3666 + Closes #3666 * ``property-with-parameters`` properly handles abstract properties - Close #3600 + Closes #3600 * ``continue-in-finally`` no longer emitted on Python 3.8 where it's now valid - Close #3612 + Closes #3612 * Fix a regression where messages with dash are not fully parsed - Close #3604 + Closes #3604 * In a TOML configuration file, it's now possible to use rich (non-string) types, such as list, integer or boolean instead of strings. For example, one can now define a *list* of message identifiers to enable like this:: @@ -28,15 +28,15 @@ Release date: 2020-06-8 "useless-suppression", ] - Close #3538 + Closes #3538 * Fix a regression where the score was not reported with multiple jobs - Close #3547 + Closes #3547 * Protect against ``AttributeError`` when checking ``cell-var-from-loop`` - Close #3646 + Closes #3646 What's New in Pylint 2.5.2? @@ -45,7 +45,7 @@ Release date: 2020-05-05 * ``pylint.Run`` accepts ``do_exit`` as a deprecated parameter - Close #3590 + Closes #3590 What's New in Pylint 2.5.1? @@ -54,25 +54,25 @@ Release date: 2020-05-05 * Fix a crash in ``method-hidden`` lookup for unknown base classes - Close #3527 + Closes #3527 * Revert pylint.Run's ``exit`` parameter to ``do_exit`` This has been inadvertently changed several releases ago to ``do_exit``. - Close #3533 + Closes #3533 * ``no-value-for-parameter`` variadic detection has improved for assign statements - Close #3563 + Closes #3563 * Allow package files to be properly discovered with multiple jobs - Close #3524 + Closes #3524 * Allow linting directories without ``__init__.py`` which was a regression in 2.5. - Close #3528 + Closes #3528 What's New in Pylint 2.5.0? @@ -81,76 +81,76 @@ Release date: 2020-04-27 * Fix a false negative for ``undefined-variable`` when using class attribute in comprehension. - Close #3494 + Closes #3494 * Fix a false positive for ``undefined-variable`` when using class attribute in decorator or as type hint. - Close #511 - Close #1976 + Closes #511 + Closes #1976 * Remove HTML quoting of messages in JSON output. - Close #2769 + Closes #2769 * Adjust the ``invalid-name`` rule to work with non-ASCII identifiers and add the ``non-ascii-name`` rule. - Close #2725 + Closes #2725 * Positional-only arguments are taken in account for ``useless-super-delegation`` * ``unidiomatic-typecheck`` is no longer emitted for ``in`` and ``not in`` operators - Close #3337 + Closes #3337 * Positional-only argument annotations are taken in account for ``unused-import`` - Close #3462 + Closes #3462 * Add a command to list available extensions. * Allow used variables to be properly consumed when different checks are enabled / disabled - Close #3445 + Closes #3445 * Fix dangerous-default-value rule to account for keyword argument defaults - Close #3373 + Closes #3373 * Fix a false positive of ``self-assigning-variable`` on tuple unpacking. - Close #3433 + Closes #3433 * ``no-self-use`` is no longer emitted for typing stubs. - Close #3439 + Closes #3439 * Fix a false positive for ``undefined-variable`` when ``__class__`` is used - Close #3090 + Closes #3090 * Emit ``invalid-name`` for variables defined in loops at module level. - Close #2695 + Closes #2695 * Add a check for cases where the second argument to ``isinstance`` is not a type. - Close #3308 + Closes #3308 * Add 'notes-rgx' option, to be used for fixme check. - Close #2874 + Closes #2874 * ``function-redefined`` exempts function redefined on a condition. - Close #2410 + Closes #2410 * ``typing.overload`` functions are exempted from docstring checks - Close #3350 + Closes #3350 * Emit ``invalid-overridden-method`` for improper async def overrides. - Close #3355 + Closes #3355 * Do not allow ``python -m pylint ...`` to import user code @@ -159,17 +159,17 @@ Release date: 2020-04-27 user level code as long as that code resides in modules having the same name as stdlib or pylint's own modules. - Close #3386 + Closes #3386 * Add ``dummy-variables-rgx`` option for ``_redeclared-assigned-name`` check. - Close #3341 + Closes #3341 * Fixed graph creation for relative paths * Add a check for asserts on string literals. - Close #3284 + Closes #3284 * ``not in`` is considered iterating context for some of the Python 3 porting checkers. @@ -177,11 +177,11 @@ Release date: 2020-04-27 * Add a check for non string assignment to __name__ attribute. - Close #583 + Closes #583 * ``__pow__``, ``__imatmul__``, ``__trunc__``, ``__floor__``, and ``__ceil__`` are recognized as special method names. - Close #3281 + Closes #3281 * Added errors for protocol functions when invalid return types are detected. E0304 (invalid-bool-returned): __bool__ did not return a bool @@ -195,31 +195,31 @@ Release date: 2020-04-27 E0312 (invalid-getnewargs-returned): __getnewargs__ did not return a tuple E0313 (invalid-getnewargs-ex-returned): __getnewargs_ex__ did not return a tuple of the form (tuple, dict) - Close #560 + Closes #560 * ``missing-*-docstring`` can look for ``__doc__`` assignments. - Close #3301 + Closes #3301 * ``undefined-variable`` can now find undefined loop iterables - Close #498 + Closes #498 * ``safe_infer`` can infer a value as long as all the paths share the same type. - Close #2503 + Closes #2503 * Add a --fail-under flag, also configurable in a .pylintrc file. If the final score is more than the specified score, it's considered a success and pylint exits with exitcode 0. Otherwise, it's considered a failure and pylint exits with its current exitcode based on the messages issued. - Close #2242 + Closes #2242 * Don't emit ``line-too-long`` for multilines when ``disable=line-too-long`` comment stands at their end - Close #2957 + Closes #2957 * Fixed an ``AttributeError`` caused by improper handling of ``dataclasses`` inference in ``pyreverse`` - Close #3256 + Closes #3256 * Do not exempt bare except from ``undefined-variable`` and similar checks @@ -228,19 +228,19 @@ Release date: 2020-04-27 We were treating bare except as a fully fledged ignore but only the corresponding exceptions should be handled that way (e.g. ``NameError`` or ``ImportError``) - Close #3235 + Closes #3235 * No longer emit ``assignment-from-no-return`` when a function only raises an exception - Close #3218 + Closes #3218 * Allow import aliases to exempt ``import-error`` when used in type annotations. - Close #3178 + Closes #3178 * ``Ellipsis` is exempted from ``multiple-statements`` for function overloads. - Close #3224 + Closes #3224 * No longer emit ``invalid-name`` for non-constants found at module level. @@ -250,16 +250,18 @@ Release date: 2020-04-27 `Constants are usually defined on a module level and written in all capital letters with underscores separating words.` - Close #3111 - Close #3132 + Closes #3111 + Closes #3132 * Allow ``implicit-str-concat-in-sequence`` to be emitted for string juxtaposition - Close #3030 + Closes #3030 * ``implicit-str-concat-in-sequence`` was renamed ``implicit-str-concat`` -* The ``json`` reporter no longer bypasses ``redirect_stdout``. Close #3227 +* The ``json`` reporter no longer bypasses ``redirect_stdout``. + + Closes #3227 * Move ``NoFileError``, ``OutputLine``, ``FunctionalTestReporter``, ``FunctionalTestFile``, ``LintModuleTest`` and related methods from @@ -268,21 +270,21 @@ Release date: 2020-04-27 * Can read config from a setup.cfg or pyproject.toml file. - Close #617 + Closes #617 * Fix exception-escape false positive with generators - Close #3128 + Closes #3128 * ``inspect.getargvalues`` is no longer marked as deprecated. * A new check ``f-string-without-interpolation`` was added - Close #3190 + Closes #3190 * Flag mutable ``collections.*`` utilities as dangerous defaults - Close #3183 + Closes #3183 * ``docparams`` extension supports multiple types in raises sections. @@ -324,11 +326,11 @@ Release date: 2020-04-27 * Fixed ``undefined-variable`` and ``unused-import`` false positives when using a metaclass via an attribute. - Close #1603 + Closes #1603 * Emit ``unused-argument`` for functions that partially uses their argument list before raising an exception. - Close #3246 + Closes #3246 * Fixed ``broad_try_clause`` extension to check try/finally statements and to check for nested statements (e.g., inside of an ``if`` statement). @@ -344,12 +346,12 @@ Release date: 2020-04-27 keyword variadics in its signature that can feasibly accept and pass on all parameters given by the overridden function. - Close #1482 - Close #1553 + Closes #1482 + Closes #1553 * Multiple types of string formatting are allowed in logging functions. The ``logging-fstring-interpolation`` message has been brought back to allow multiple types of string formatting to be used. - Close #3361 + Closes #3361 diff --git a/doc/whatsnew/2/2.6/full.rst b/doc/whatsnew/2/2.6/full.rst index 0aa2ee35dc..3896677dc0 100644 --- a/doc/whatsnew/2/2.6/full.rst +++ b/doc/whatsnew/2/2.6/full.rst @@ -7,7 +7,7 @@ Release date: 2021-02-16 * Astroid version has been set as < 2.5 - Close #4093 + Closes #4093 What's New in Pylint 2.6.0? @@ -16,23 +16,23 @@ Release date: 2020-08-20 * Fix various scope-related bugs in ``undefined-variable`` checker - Close #1082, #3434, #3461 + Closes #1082, #3434, #3461 * bad-continuation and bad-whitespace have been removed, black or another formatter can help you with this better than Pylint - Close #246, #289, #638, #747, #1148, #1179, #1943, #2041, #2301, #2304, #2944, #3565 + Closes #246, #289, #638, #747, #1148, #1179, #1943, #2041, #2301, #2304, #2944, #3565 * The no-space-check option has been removed. It's no longer possible to consider empty line like a ``trailing-whitespace`` by using clever options - Close #1368 + Closes #1368 * ``missing-kwoa`` is no longer emitted when dealing with overload functions - Close #3655 + Closes #3655 * mixed-indentation has been removed, it is no longer useful since TabError is included directly in python3 - Close #2984 #3573 + Closes #2984 #3573 * Add ``super-with-arguments`` check for flagging instances of Python 2 style super calls. @@ -40,7 +40,7 @@ Release date: 2020-08-20 * Fix superfluous-parens false-positive for the walrus operator - Close #3383 + Closes #3383 * Fix ``fail-under`` not accepting floats @@ -50,18 +50,18 @@ Release date: 2020-08-20 * Fix a crash in parallel mode when the module's filepath is not set - Close #3564 + Closes #3564 * Add ``raise-missing-from`` check for exceptions that should have a cause. * Support both isort 4 and isort 5. If you have pinned isort 4 in your projet requirements, nothing changes. If you use isort 5, though, note that the ``known-standard-library`` option is not interpreted the same in isort 4 and isort 5 (see the migration guide in isort documentation for further details). For compatibility's sake for most pylint users, the ``known-standard-library`` option in pylint now maps to ``extra-standard-library`` in isort 5. If you really want what ``known-standard-library`` now means in isort 5, you must disable the ``wrong-import-order`` check in pylint and run isort manually with a proper isort configuration file. - Close #3722 + Closes #3722 * Fix a crash caused by not guarding against ``InferenceError`` when calling ``infer_call_result`` - Close #3690 + Closes #3690 * Fix a crash in parallel mode when the module's filepath is not set - Close #3564 + Closes #3564 diff --git a/doc/whatsnew/2/2.7/full.rst b/doc/whatsnew/2/2.7/full.rst index cc3c914be6..6e528369ea 100644 --- a/doc/whatsnew/2/2.7/full.rst +++ b/doc/whatsnew/2/2.7/full.rst @@ -49,7 +49,7 @@ Release date: 2021-03-29 * Add ``allowed-redefined-builtins`` option for fine tuning ``redefined-builtin`` check. - Close #3263 + Closes #3263 * Fix issue when executing with ``python -m pylint`` @@ -98,6 +98,7 @@ What's New in Pylint 2.7.2? Release date: 2021-02-28 * Fix False Positive on ``Enum.__members__.items()``, ``Enum.__members__.values``, and ``Enum.__members__.keys`` + Closes #4123 * Properly strip dangerous sys.path entries (not just the first one) @@ -154,7 +155,7 @@ Release date: 2021-02-21 * Enums are now required to be named in UPPER_CASE by ``invalid-name``. - Close #3834 + Closes #3834 * Add missing checks for deprecated functions. @@ -188,11 +189,11 @@ Release date: 2021-02-21 * Fix a crash in ``undefined-variable`` caused by chained attributes in metaclass - Close #3742 + Closes #3742 * Fix false positive for ``not-async-context-manager`` when ``contextlib.asynccontextmanager`` is used - Close #3862 + Closes #3862 * Fix linter multiprocessing pool shutdown (triggered warnings when ran in parallels with other pytest plugins) @@ -205,16 +206,16 @@ Release date: 2021-02-21 * Fix bug that lead to duplicate messages when using ``--jobs 2`` or more. - Close #3584 + Closes #3584 * Adds option ``check-protected-access-in-special-methods`` in the ClassChecker to activate/deactivate ``protected-access`` message emission for single underscore prefixed attribute in special methods. - Close #3120 + Closes #3120 * Fix vulnerable regular expressions in ``pyreverse`` - Close #3811 + Closes #3811 * ``inconsistent-return-statements`` message is now emitted if one of ``try/except`` statement is not returning explicitly while the other do. @@ -223,17 +224,17 @@ Release date: 2021-02-21 * Fix ``useless-super-delegation`` false positive when default keyword argument is a dictionary. - Close #3773 + Closes #3773 * Fix a crash when a specified config file does not exist * Add support to ``ignored-argument-names`` in DocstringParameterChecker and adds ``useless-param-doc`` and ``useless-type-doc`` messages. - Close #3800 + Closes #3800 * Enforce docparams consistently when docstring is not present - Close #2738 + Closes #2738 * Fix ``duplicate-code`` false positive when lines only contain whitespace and non-alphanumeric characters (e.g. parentheses, bracket, comma, etc.) @@ -241,7 +242,7 @@ Release date: 2021-02-21 * Fix spell-checker crash on indented docstring lines that look like # comments - Close #3786 + Closes #3786 * Fix AttributeError in checkers/refactoring.py @@ -249,7 +250,7 @@ Release date: 2021-02-21 * Fix a bug with postponed evaluation when using aliases for annotations. - Close #3798 + Closes #3798 * Fix minor documentation issues @@ -259,23 +260,23 @@ Release date: 2021-02-21 * Fix ``signature-differs`` false positive for functions with variadics - Close #3737 + Closes #3737 * Fix a crash in ``consider-using-enumerate`` when encountering ``range()`` without arguments - Close #3735 + Closes #3735 * ``len-as-conditions`` is now triggered only for classes that are inheriting directly from list, dict, or set and not implementing the ``__bool__`` function, or from generators like range or list/dict/set comprehension. This should reduce the false positives for other classes, like pandas's DataFrame or numpy's Array. - Close #1879 + Closes #1879 * Fixes duplicate-errors not working with -j2+ - Close #3314 + Closes #3314 * ``generated-members`` now matches the qualified name of members - Close #2498 + Closes #2498 * Add check for bool function to ``len-as-condition`` @@ -283,11 +284,11 @@ Release date: 2021-02-21 * Add ``condition-evals-to-constant`` check for conditionals using and/or that evaluate to a constant. - Close #3407 + Closes #3407 * Changed setup.py to work with `distlib `_ - Close #3555 + Closes #3555 * New check: ``consider-using-generator`` @@ -295,6 +296,6 @@ Release date: 2021-02-21 since it is unnecessary and should be replaced by a generator instead. Using a generator would be less code and way faster. - Close #3165 + Closes #3165 * Add Github Actions to replace Travis and AppVeyor in the future diff --git a/doc/whatsnew/2/2.8/full.rst b/doc/whatsnew/2/2.8/full.rst index a0ee3a8566..a37f633d02 100644 --- a/doc/whatsnew/2/2.8/full.rst +++ b/doc/whatsnew/2/2.8/full.rst @@ -5,7 +5,9 @@ What's New in Pylint 2.8.3? --------------------------- Release date: 2021-05-31 -* Astroid has been pinned to 2.5.6 for the 2.8 branch see #4527. +* Astroid has been pinned to 2.5.6 for the 2.8 branch. + + Refs #4527 What's New in Pylint 2.8.2? @@ -23,7 +25,7 @@ Release date: 2021-04-26 * New warning message ``deprecated-class``. This message is emitted if import or call deprecated class of the standard library (like ``collections.Iterable`` that will be removed in Python 3.10). -Closes #4388 + Closes #4388 What's New in Pylint 2.8.1? diff --git a/doc/whatsnew/2/2.9/full.rst b/doc/whatsnew/2/2.9/full.rst index 868ef70239..5518f54646 100644 --- a/doc/whatsnew/2/2.9/full.rst +++ b/doc/whatsnew/2/2.9/full.rst @@ -197,7 +197,7 @@ Release date: 2021-06-29 * Added ``ignore-paths`` behaviour. Defined regex patterns are matched against full file path. - Close #2541 + Closes #2541 * Fix false negative for ``consider-using-with`` if calls like ``open()`` were used outside of assignment expressions. diff --git a/script/check_changelog.py b/script/check_changelog.py new file mode 100644 index 0000000000..77f2d61b41 --- /dev/null +++ b/script/check_changelog.py @@ -0,0 +1,145 @@ +# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html +# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt + +"""Small script to check the changelog. Used by 'changelog.yml' and pre-commit. + +If no issue number is provided we only check that proper formatting is respected.""" + +from __future__ import annotations + +import argparse +import re +import sys +from collections.abc import Iterator +from pathlib import Path +from re import Pattern + +VALID_ISSUES_KEYWORDS = ["Refs", "Closes", "Follow-up in", "Fixes part of"] +ISSUE_NUMBER_PATTERN = r"#\d{1,5}" +VALID_ISSUE_NUMBER_PATTERN = r"\*[\S\s]*?" + ISSUE_NUMBER_PATTERN +ISSUES_KEYWORDS = "|".join(VALID_ISSUES_KEYWORDS) +PREFIX_CHANGELOG_PATTERN = ( + rf"(\*\s[\S[\n ]+?]*\n\n\s\s({ISSUES_KEYWORDS})) (PyCQA/astroid)?" +) +VALID_CHANGELOG_PATTERN = PREFIX_CHANGELOG_PATTERN + ISSUE_NUMBER_PATTERN + +ISSUE_NUMBER_COMPILED_PATTERN = re.compile(ISSUE_NUMBER_PATTERN) +VALID_CHANGELOG_COMPILED_PATTERN: Pattern[str] = re.compile(VALID_CHANGELOG_PATTERN) +VALID_ISSUE_NUMBER_COMPILED_PATTERN: Pattern[str] = re.compile( + VALID_ISSUE_NUMBER_PATTERN +) + +DOC_PATH = (Path(__file__).parent / "../doc/").resolve() +PATH_TO_WHATSNEW = DOC_PATH / "whatsnew" +UNCHECKED_VERSION = [ + # Not checking version prior to 1.0.0 because the issues referenced are a mix + # between Logilab internal issue and Bitbucket. It's hard to tell, it's + # inaccessible for Logilab and often dead links for Bitbucket anyway. + # Not very useful generally, unless you're an open source historian. + "0.x", + # Too much Bitbucket issues in this one : + "1.0", + "1.1", + "1.2", +] + +NO_CHECK_REQUIRED_FILES = { + "index.rst", + "full_changelog_explanation.rst", + "summary_explanation.rst", +} + + +def sorted_whatsnew(verbose: bool) -> Iterator[Path]: + """Return the whats-new in the 'right' numerical order ('9' before '10')""" + numeric_whatsnew = {} + for file in PATH_TO_WHATSNEW.glob("**/*"): + relpath_file = file.relative_to(DOC_PATH) + if file.is_dir(): + if verbose: + print(f"I don't care about '{relpath_file}', it's a directory : 🤖🤷") + continue + if file.name in NO_CHECK_REQUIRED_FILES: + if verbose: + print( + f"I don't care about '{relpath_file}' it's in 'NO_CHECK_REQUIRED_FILES' : 🤖🤷" + ) + continue + version = ( + file.parents[0].name if file.stem in {"summary", "full"} else file.stem + ) + if any(version == x for x in UNCHECKED_VERSION): + if verbose: + print( + f"I don't care about '{relpath_file}' {version} is in UNCHECKED_VERSION : 🤖🤷" + ) + continue + if verbose: + print(f"I'm going to check '{relpath_file}' 🤖") + num = tuple(int(x) for x in (version.split("."))) + numeric_whatsnew[num] = file + for num in sorted(numeric_whatsnew): + yield numeric_whatsnew[num] + + +def main(argv: list[str] | None = None) -> int: + argv = argv or sys.argv[1:] + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--issue-number", + type=int, + default=0, + help="The issue we expect to find in the changelog.", + ) + parser.add_argument("--verbose", "-v", action="count", default=0) + args = parser.parse_args(argv) + verbose = args.verbose + is_valid = True + for file in sorted_whatsnew(verbose): + if not check_file(file, verbose): + is_valid = False + return 0 if is_valid else 1 + + +def check_file(file: Path, verbose: bool) -> bool: + """Check that a file contain valid change-log's entries.""" + with open(file, encoding="utf8") as f: + content = f.read() + valid_full_descriptions = VALID_CHANGELOG_COMPILED_PATTERN.findall(content) + result = len(valid_full_descriptions) + contain_issue_number_descriptions = VALID_ISSUE_NUMBER_COMPILED_PATTERN.findall( + content + ) + expected = len(contain_issue_number_descriptions) + if result != expected: + return create_detailed_fail_message( + file, contain_issue_number_descriptions, valid_full_descriptions + ) + if verbose: + relpath_file = file.relative_to(DOC_PATH) + print(f"Checked '{relpath_file}' : LGTM 🤖👍") + return True + + +def create_detailed_fail_message( + file_name: Path, + contain_issue_number_descriptions: list, + valid_full_descriptions: list, +) -> bool: + is_valid = True + for issue_number_description in contain_issue_number_descriptions: + if not any(v[0] in issue_number_description for v in valid_full_descriptions): + is_valid = False + issue_number = ISSUE_NUMBER_COMPILED_PATTERN.findall( + issue_number_description + )[0] + print( + f"{file_name}: {issue_number}'s description is not on one line, or " + "does not respect the standard format 🤖👎" + ) + return is_valid + + +if __name__ == "__main__": + sys.exit(main())