What's New In Pylint 1.5#
What's New in Pylint 1.5.5?#
Release date: 2016-03-21
Let visit_importfrom from Python 3 porting checker be called when everything is disabled
Because the visit method was filtering the patterns it was expecting to be activated, it didn't run when everything but one pattern was disabled, leading to spurious false positives
Don't emit unsubscriptable-value for classes with unknown base classes.
Use an OrderedDict for storing the configuration elements
This fixes an issue related to impredictible order of the disable / enable elements from a config file. In certain cases, the disable was coming before the enable which resulted in classes of errors to be enabled, even though the intention 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.
Don't consider bare and broad except handlers as ignoring NameError, AttributeError and similar exceptions, in the context of checkers for these issues.
What's New in Pylint 1.5.4?#
Release date: 2016-01-15
Merge StringMethodChecker with StringFormatChecker. This fixes a bug where disabling all the messages and enabling only a handful of messages from the StringFormatChecker would have resulted in no messages at all.
Don't apply unneeded-not over sets.
What's New in Pylint 1.5.3?#
Release date: 2016-01-11
Handle the import fallback idiom with regard to wrong-import-order.
Decouple the displaying of reports from the displaying of messages
Some reporters are aggregating the messages instead of displaying them when they are available. The actual displaying was conflatted in the generate_reports. Unfortunately this behaviour was flaky and in the case of the JSON reporter, the messages weren't shown at all if a file had syntax errors or if it was missing. In order to fix this, the aggregated messages can now be displayed with Reporter.display_message, while the reports are displayed with display_reports.
Closes #766 Closes #765
Ignore function calls with variadic arguments without a context.
Inferring variadic positional arguments and keyword arguments will result into empty Tuples and Dicts, which can lead in 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.
Treat AsyncFunctionDef just like FunctionDef nodes, by implementing visit_asyncfunctiondef in terms of visit_functiondef.
Take in account kwonlyargs when verifying that arguments are defined with the check_docs extension.
Suppress reporting 'unneeded-not' inside
What's New in Pylint 1.5.2?#
Release date: 2015-12-21
Don't crash if graphviz is not installed, instead emit a warning letting the user to know.
Accept only functions and methods for the deprecated-method checker.
This prevents a crash which can occur when an object doesn't have .qname() method after the inference.
Don't emit super-on-old-class on classes with unknown bases.
Allow statements in
tryblocks containing imports.
What's New in Pylint 1.5.1?#
Release date: 2015-12-02
Fix a crash which occurred when old visit methods are encountered in plugin modules.
Add wrong-import-position to check_messages's decorator arguments for ImportChecker.leave_module This fixes an esoteric bug which occurs when ungrouped-imports and wrong-import-order are disabled and pylint is executed on multiple files. What happens is that without wrong-import-position in check_messages, leave_module will never be called, which means that the first non-import node from other files might leak into the current file, leading to wrong-import-position being emitted by pylint.
Fix a crash which occurred when old visit methods are encountered in plugin modules.
Don't emit import-self and cyclic-import for relative imports of modules with the same name as the package itself.
Closes #708 Closes #706.
What's New in Pylint 1.5.0?#
Release date: 2015-11-29
Added multiple warnings related to imports. 'wrong-import-order' is emitted when PEP 8 recommendations regarding imports are not respected (that is, standard imports should be followed by third-party imports and then by local imports). 'ungrouped-imports' is emitted when imports from the same package or module are not placed together, but scattered around in the code. 'wrong-import-position' 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.
Added a new refactoring warning, 'unneeded-not', emitted when an expression with the not operator could be simplified.
Added a new refactoring warning, 'simplifiable-if-statement', used when an if statement could be reduced to a boolean evaluation of its test.
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.
Property methods are shown as attributes instead of functions in pyreverse class diagrams.
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.
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.
Obsolete options are not present by default in the generated configuration file.
non-iterator-returned can detect classes with iterator-metaclasses.
Add a new error, 'unsupported-membership-test', emitted when value to the right of the 'in' operator doesn't support membership test protocol (i.e. doesn't define __contains__/__iter__/__getitem__)
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.
Make 'no-self-use' checker not emit a warning if there is a 'super()' call inside the method.
Add checker to identify multiple imports on one line.
Fix unused-argument false positive when the "+=" operator is used.
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.
Fix unused-import false positive when the import is used in a class assignment.
Add a new error, 'not-context-manager', emitted when something that doesn't implement __enter__ and __exit__ is used in a with statement.
Add a new warning, 'confusing-with-statement', emitted by the base checker, when an ambiguous looking with statement is used. For example with open() as first, second which looks like a tuple assignment but is actually 2 context managers.
Add a new warning, 'duplicate-except', emitted when there is an exception handler which handles an exception type that was handled before.
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.
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=....
--jobs can be used with --load-plugins now.
Improve the performance of --jobs when dealing only with a package name.
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.
Remove pointless-except warning. It was previously disabled by default and it wasn't very useful.
Fix a crash on Python 3 related to the string checker, which crashed when it encountered a bytes string with a .format method called.
Don't warn about no-self-use for builtin properties.
Fix a false positive for bad-reversed-sequence, when a subclass of a
dictprovides a __reversed__ method.
Change the default no-docstring-rgx so missing-docstring isn't emitted for private functions.
Don't emit redefined-outer-name for __future__ directives.
Provide some hints for the bad-builtin message.
When checking for invalid arguments to a callable, in typecheck.py, look up for the __init__ in case the found __new__ comes from builtins.
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.
Don't emit no-member for classes with unknown bases.
Since we don't know what those bases might add, we simply ignore the error in this case.
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.
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.
Remove interface-not-implemented warning.
Remove the rest of interface checks: interface-is-not-class, missing-interface-method, unresolved-interface. The reason is that its better to start recommending ABCs instead of the old Zope era of interfaces. One side effect of this change is that ignore-iface-methods becomes a noop, it's deprecated and it will be removed at some time.
Emit a proper deprecation warning for reporters.BaseReporter.add_message.
The alternative way is to use handle_message. add_message will be removed in Pylint 1.6.
Added new module 'extensions' for optional checkers with the test directory 'test/extensions' and documentation file 'doc/extensions.rst'.
Added new checker 'extensions.check_docs' that verifies parameter documentation in Sphinx, Google, and Numpy style.
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.
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.
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 #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.
Remove 'bad-context-manager' due to the inclusion of 'unexpected-special-method-signature'.
Don't emit no-name-in-module if the import is guarded by an ImportError, Exception or a bare except clause.
Don't emit no-member if the attribute access node is protected by an except handler, which handles AttributeError, Exception or it is a bare except.
Don't emit import-error if the import is guarded by an ImportError, Exception or a bare except clause.
Don't emit undefined-variable if the node is guarded by a NameError, Exception or bare except clause.
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.
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 to assume that the user knows what he is doing rather than emitting a message which can be considered a false positive.
Look for a .pylintrc configuration file in the current folder, if pylintrc is not found. Dotted pylintrc files will not be searched in the parents of the current folder, as it is done for pylintrc.
Add a new error, 'invalid-unary-type-operand', emitted when an unary operand is used on something which doesn't support that operation (for instance, using the unary bitwise inversion operator on an instance which doesn't implement __invert__).
Take in consideration differences between arguments of various type of functions (classmethods, staticmethods, properties) when checking for
astroid.inspector was moved to pylint.pyreverse, since it belongs there and it doesn't need to be in astroid.
astroid.utils.LocalsVisitor was moved to pylint.pyreverse.LocalsVisitor.
pylint.checkers.utils.excepts_import_error was removed. Use pylint.chekcers.utils.error_of_type instead.
Don't emit undefined-all-variables for nodes which can't be inferred (YES nodes).
yield-outside-func is also emitted for
Add a new error, 'too-many-star-expressions', emitted when there are more than one starred expression (*x) in an assignment. The warning is emitted only on Python 3.
Add a new error, 'invalid-star-assignment-target', emitted when a starred expression (*x) is used as the lhs side of an assignment, as in *x = [1, 2]. This is not a SyntaxError on Python 3 though.
Detect a couple of objects which can't be base classes (bool, slice, range and memoryview, which weren't detected until now).
Add a new error for the Python 3 porting checker,
import-star-module-level, which is used when a star import is detected in another scope than the module level, which is an error on Python 3. Using this will emit a SyntaxWarning on Python 2.
Add a new error, 'star-needs-assignment-target', emitted on Python 3 when a Starred expression (*x) is not used in an assignment target. This is not caught when parsing the AST on Python 3, so it needs to be a separate check.
Add a new error, 'unsupported-binary-operation', emitted when two a binary arithmetic operation is executed between two objects which don't support it (a number plus a string for instance). This is currently disabled, since the it exhibits way too many false positives, but it will be re-enabled as soon as possible.
New imported features from astroid into pyreverse: pyreverse.inspector.Project, pyreverse.inspector.project_from_files and pyreverse.inspector.interfaces.
These were moved since they didn't belong in astroid.
Enable misplaced-future for Python 3.
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.
ignored-classes option can work with qualified names (ignored-classes=optparse.Values)
ignored-modules can work with qualified names as well as with Unix pattern matching for recursive ignoring.
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.
--no-space-check option accepts
empty-lineas a possible option.
--generate-rcfile generates by default human readable symbols for the --disable option.
Improved the not-in-loop checker to properly detect more cases.
Add a new error, 'continue-in-finally', which is emitted when the
continuekeyword is found inside a
finallyclause, which is a SyntaxError.
The --zope flag is deprecated and it is slated for removal in Pylint 1.6.
The reason behind this removal is the fact that it's a specialized flag and there are solutions for the original problem: use --generated-members with the members that causes problems when using Zope or add AST transforms tailored to the zope project.
At the same time, --include-ids and --symbols will also be removed in Pylint 1.6.
missing-module-attribute was removed and the corresponding CLI option, required-attributes, which is slated for removal in Pylint 1.6.
missing-reversed-argument was removed.
The reason behind this is that this kind of errors should be detected by the type checker for all the builtins and not as a special case for the reversed builtin. This will happen shortly in the future.
--comment flag is obsolete and it will be removed in Pylint 1.6.
--profile flag is obsolete and it will be removed in Pylint 1.6.
Add a new error, 'misplaced-bare-raise'.
The error is used when a bare raise is not used inside an except clause. This can generate a RuntimeError in Python, if there are no active exceptions to be reraised. While it works in Python 2 due to the fact that the exception 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.
Bring logilab-common's ureports into pylint.reporters.
With this change, we moved away from depending on logilab-common, 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.
reimportedis emitted for reimported objects on the same line.
Abbreviations of command line options are not supported anymore.
Using abbreviations for CLI options was never considered to be 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.
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.
- 'deprecated-module' can be shown for modules which aren't
Don't consider a class abstract if its members can't be properly inferred.
This fixes a false positive related to abstract-class-instantiated.
Add a new checker for the async features added by PEP 492.
Add a new error, 'yield-inside-async-function', emitted on Python 3.5 and upwards when the
yieldstatement is found inside a new coroutine function (PEP 492).
Add a new error, 'not-async-context-manager', emitted when an async context manager block is used with an object which doesn't support this protocol (PEP 492).
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.
Add a new error, 'repeated-keyword', when a keyword argument is passed multiple times into a function call.
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.
Add a new convention message, 'misplaced-comparison-constant', emitted when a constant is placed in the left hand side of a comparison, as in '5 == func()'. This is also called Yoda condition, since the flow of code reminds of the Star Wars green character, conditions usually encountered in languages with variabile assignments in conditional statements.
Add a new convention message, 'consider-using-enumerate', which is emitted when code that uses
lenfor iterating is encountered.
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.