Debian Codegraph @

doc/whatsnew/1/1.5.rst

raw
1 **************************
2 What's New In Pylint 1.5
3 **************************
4
5 What's New in Pylint 1.5.5?
6 ===========================
7 Release date: 2016-03-21
8
9 * Let visit_importfrom from Python 3 porting checker be called when everything is disabled
10
11 Because the visit method was filtering the patterns it was expecting to be activated,
12 it didn't run when everything but one pattern was disabled, leading to spurious false
13 positives
14
15 Closes #852
16
17 * Don't emit unsubscriptable-value for classes with unknown
18 base classes.
19
20 Closes #776.
21
22 * Use an OrderedDict for storing the configuration elements
23
24 This fixes an issue related to impredictible order of the disable / enable
25 elements from a config file. In certain cases, the disable was coming before
26 the enable which resulted in classes of errors to be enabled, even though the intention
27 was to disable them. The best example for this was in the context of running multiple
28 processes, each one of it having different enables / disables that affected the output.
29
30 Closes #815
31
32 * Don't consider bare and broad except handlers as ignoring NameError,
33 AttributeError and similar exceptions, in the context of checkers for
34 these issues.
35
36 Closes #826
37
38
39 What's New in Pylint 1.5.4?
40 ===========================
41 Release date: 2016-01-15
42
43
44 * Merge StringMethodChecker with StringFormatChecker. This fixes a
45 bug where disabling all the messages and enabling only a handful of
46 messages from the StringFormatChecker would have resulted in no
47 messages at all.
48
49 * Don't apply :ref:`unneeded-not` over sets.
50
51
52 What's New in Pylint 1.5.3?
53 ===========================
54 Release date: 2016-01-11
55
56 * Handle the import fallback idiom with regard to :ref:`wrong-import-order`.
57
58 Closes #750
59
60 * Decouple the displaying of reports from the displaying of messages
61
62 Some reporters are aggregating the messages instead of displaying
63 them when they are available. The actual displaying was conflatted
64 in the generate_reports. Unfortunately this behaviour was flaky
65 and in the case of the JSON reporter, the messages weren't shown
66 at all if a file had syntax errors or if it was missing.
67 In order to fix this, the aggregated messages can now be
68 displayed with Reporter.display_message, while the reports are
69 displayed with display_reports.
70
71 Closes #766
72 Closes #765
73
74 * Ignore function calls with variadic arguments without a context.
75
76 Inferring variadic positional arguments and keyword arguments
77 will result into empty Tuples and Dicts, which can lead in
78 some cases to false positives with regard to :ref:`no-value-for-parameter`.
79 In order to avoid this, until we'll have support for call context
80 propagation, we're ignoring such cases if detected.
81
82 Closes #722
83
84 * Treat AsyncFunctionDef just like FunctionDef nodes,
85 by implementing visit_asyncfunctiondef in terms of
86 visit_functiondef.
87
88 Closes #767
89
90 * Take in account kwonlyargs when verifying that arguments
91 are defined with the check_docs extension.
92
93 Closes #745
94
95 * Suppress reporting :ref:`unneeded-not` inside ``__ne__`` methods
96
97 Closes #749
98
99
100 What's New in Pylint 1.5.2?
101 ===========================
102 Release date: 2015-12-21
103
104 * Don't crash if graphviz is not installed, instead emit a
105 warning letting the user to know.
106
107 Closes #168
108
109 * Accept only functions and methods for the :ref:`deprecated-method` checker.
110
111 This prevents a crash which can occur when an object doesn't have
112 .qname() method after the inference.
113
114 * Don't emit super-on-old-class on classes with unknown bases.
115
116 Closes #721
117
118 * Allow statements in ``if`` or ``try`` blocks containing imports.
119
120 Closes #714
121
122
123 What's New in Pylint 1.5.1?
124 ===========================
125 Release date: 2015-12-02
126
127
128 * Fix a crash which occurred when old visit methods are encountered
129 in plugin modules.
130
131 Closes #711
132
133 * Add :ref:`wrong-import-position` to check_messages's decorator arguments
134 for ImportChecker.leave_module
135 This fixes an esoteric bug which occurs when :ref:`ungrouped-imports` and
136 :ref:`wrong-import-order` are disabled and pylint is executed on multiple files.
137 What happens is that without :ref:`wrong-import-position` in check_messages,
138 leave_module will never be called, which means that the first non-import node
139 from other files might leak into the current file,
140 leading to :ref:`wrong-import-position` being emitted by pylint.
141
142 * Fix a crash which occurred when old visit methods are encountered
143 in plugin modules.
144
145 Closes #711
146
147 * Don't emit :ref:`import-self` and :ref:`cyclic-import` for relative imports
148 of modules with the same name as the package itself.
149
150 Closes #708
151 Closes #706.
152
153
154 What's New in Pylint 1.5.0?
155 ===========================
156 Release date: 2015-11-29
157
158 * Added multiple warnings related to imports. :ref:`wrong-import-order`
159 is emitted when PEP 8 recommendations regarding imports are not
160 respected (that is, standard imports should be followed by third-party
161 imports and then by local imports). :ref:`ungrouped-imports` is emitted
162 when imports from the same package or module are not placed
163 together, but scattered around in the code. :ref:`wrong-import-position`
164 is emitted when code is mixed with imports, being recommended for the
165 latter to be at the top of the file, in order to figure out easier by
166 a human reader what dependencies a module has.
167
168 Closes #692
169
170 * Added a new refactoring warning, :ref:`unneeded-not`, emitted
171 when an expression with the not operator could be simplified.
172
173 Closes #670
174
175 * Added a new refactoring warning, :ref:`simplifiable-if-statement`,
176 used when an if statement could be reduced to a boolean evaluation
177 of its test.
178
179 Closes #698
180
181 * Added a new refactoring warning, :ref:`too-many-boolean-expressions`,
182 used when an if statement contains too many boolean expressions,
183 which makes the code less maintainable and harder to understand.
184
185 Closes #677
186
187 * Property methods are shown as attributes instead of functions in
188 pyreverse class diagrams.
189
190 Closes #284
191
192 * Add a new refactoring error, :ref:`too-many-nested-blocks`, which is emitted
193 when a function or a method has too many nested blocks, which makes the
194 code less readable and harder to understand.
195
196 Closes #668
197
198 * Add a new error, :ref:`unsubscriptable-object`, that is emitted when
199 value used in subscription expression doesn't support subscription
200 (i.e. doesn't define __getitem__ method).
201
202 * Don't warn about abstract classes instantiated in their own body.
203
204 Closes #627
205
206 * Obsolete options are not present by default in the generated
207 configuration file.
208
209 Closes #632
210
211 * :ref:`non-iterator-returned` can detect classes with iterator-metaclasses.
212
213 Closes #679
214
215 * Add a new error, :ref:`unsupported-membership-test`, emitted when value
216 to the right of the 'in' operator doesn't support membership test
217 protocol (i.e. doesn't define __contains__/__iter__/__getitem__)
218
219 * Add new errors, :ref:`not-an-iterable`, emitted when non-iterable value
220 is used in an iterating context (starargs, for-statement,
221 comprehensions, etc), and :ref:`not-a-mapping`, emitted when non-mapping
222 value is used in a mapping context.
223
224 Closes #563
225
226 * Make :ref:`no-self-use` checker not emit a warning if there is a 'super()'
227 call inside the method.
228
229 Closes #667
230
231 * Add checker to identify multiple imports on one line.
232
233 Closes #598
234
235 * Fix :ref:`unused-argument` false positive when the "+=" operator is used.
236
237 Closes #518
238
239 * Don't emit :ref:`import-error` for ignored modules. PyLint will not emit import
240 errors for any import which is, or is a subpackage of, a module in
241 the ignored-modules list.
242
243 Closes #223
244
245 * Fix :ref:`unused-import` false positive when the import is used in a
246 class assignment.
247
248 Closes #475
249
250 * Add a new error, :ref:`not-context-manager`, emitted when something
251 that doesn't implement __enter__ and __exit__ is used in a with
252 statement.
253
254 * Add a new warning, :ref:`confusing-with-statement`, emitted by the
255 base checker, when an ambiguous looking with statement is used.
256 For example `with open() as first, second` which looks like a
257 tuple assignment but is actually 2 context managers.
258
259 * Add a new warning, :ref:`duplicate-except`, emitted when there is an
260 exception handler which handles an exception type that was handled
261 before.
262
263 Closes #485
264
265 * A couple of warnings got promoted to errors, since they could uncover
266 potential bugs in the code. These warnings are: :ref:`assignment-from-none`,
267 :ref:`unbalanced-tuple-unpacking`, :ref:`unpacking-non-sequence`, :ref:`non-iterator-returned`.
268
269 Closes #388
270
271 * Allow ending a pragma control with a semicolon. In this way, users
272 can continue a pragma control with a reason for why it is used,
273 as in `# pylint: disable=old-style-class;reason=...`.
274
275 Closes #449
276
277 * --jobs can be used with --load-plugins now.
278
279 Closes #456
280
281 * Improve the performance of --jobs when dealing only with a package name.
282
283 Closes #479
284
285 * Don't emit an :ref:`unused-wildcard-import` when the imported name comes
286 from another module and it is in fact a __future__ name.
287
288 * The colorized reporter now works on Windows.
289
290 Closes #96.
291
292 * Remove pointless-except warning. It was previously disabled by
293 default and it wasn't very useful.
294
295 Closes #506.
296
297 * Fix a crash on Python 3 related to the string checker, which
298 crashed when it encountered a bytes string with a .format
299 method called.
300
301 * Don't warn about :ref:`no-self-use` for builtin properties.
302
303 * Fix a false positive for :ref:`bad-reversed-sequence`, when a subclass
304 of a ``dict`` provides a __reversed__ method.
305
306 * Change the default no-docstring-rgx so :ref:`missing-docstring` isn't
307 emitted for private functions.
308
309 * Don't emit :ref:`redefined-outer-name` for __future__ directives.
310
311 Closes #520.
312
313 * Provide some hints for the :ref:`bad-builtin` message.
314
315 Closes #522.
316
317 * When checking for invalid arguments to a callable, in typecheck.py,
318 look up for the __init__ in case the found __new__ comes from builtins.
319
320 Since the __new__ comes from builtins, it will not have attached any
321 information regarding what parameters it expects, so the check
322 will be useless. Retrieving __init__ in that case will at least
323 detect a couple of false negatives.
324
325 Closes #429.
326
327 * Don't emit :ref:`no-member` for classes with unknown bases.
328
329 Since we don't know what those bases might add, we simply ignore
330 the error in this case.
331
332 * Lookup in the implicit metaclass when checking for :ref:`no-member`,
333 if the class in question has an implicit metaclass, which is
334 True for new style classes.
335
336 Closes #438.
337
338 * Add two new warnings, :ref:`duplicate-bases` and :ref:`inconsistent-mro`.
339
340 :ref:`duplicate-bases` is emitted when a class has the same bases
341 listed more than once in its bases definition, while :ref:`inconsistent-mro`
342 is emitted when no sane mro hierarchy can be determined.
343
344 Closes #526.
345
346 * Remove interface-not-implemented warning.
347
348 Closes #532.
349
350 * Remove the rest of interface checks: interface-is-not-class,
351 missing-interface-method, unresolved-interface. The reason is that
352 it's better to start recommending ABCs instead of the old Zope era
353 of interfaces. One side effect of this change is that ignore-iface-methods
354 becomes a noop, it's deprecated and it will be removed at some time.
355
356 * Emit a proper deprecation warning for reporters.BaseReporter.add_message.
357
358 The alternative way is to use handle_message. add_message will be removed in
359 Pylint 1.6.
360
361 * Added new module 'extensions' for optional checkers with the test
362 directory 'test/extensions' and documentation file 'doc/extensions.rst'.
363
364 * Added new checker 'extensions.check_docs' that verifies parameter
365 documentation in Sphinx, Google, and Numpy style.
366
367 * Detect undefined variable cases, where the "definition" of an undefined
368 variable was in del statement. Instead of emitting :ref:`used-before-assignment`,
369 which is totally misleading, it now emits :ref:`undefined-variable`.
370
371 Closes #528.
372
373 * Don't emit :ref:`attribute-defined-outside-init` and :ref:`access-member-before-definition`
374 for mixin classes. Actual errors can occur in mixin classes, but this is
375 controlled by the ignore-mixin-members option.
376
377 Closes #412.
378
379 * Improve the detection of undefined variables and variables used before
380 assignment for variables used as default arguments to function,
381 where the variable was first defined in the class scope.
382
383 Closes #342 and issue #404.
384
385 * Add a new warning, :ref:`unexpected-special-method-signature`, which is emitted
386 when a special method (dunder method) doesn't have the expected signature,
387 which can lead to actual errors in the application code.
388
389 Closes #253.
390
391 * Remove :ref:`bad-context-manager` due to the inclusion of :ref:`unexpected-special-method-signature`.
392
393 * Don't emit :ref:`no-name-in-module` if the import is guarded by an ImportError, Exception or
394 a bare except clause.
395
396 * Don't emit :ref:`no-member` if the attribute access node is protected by an
397 except handler, which handles AttributeError, Exception or it is a
398 bare except.
399
400 * Don't emit :ref:`import-error` if the import is guarded by an ImportError, Exception or a
401 bare except clause.
402
403 * Don't emit :ref:`undefined-variable` if the node is guarded by a NameError, Exception
404 or bare except clause.
405
406 * Add a new warning, :ref:`using-constant-test`, which is emitted when a conditional
407 statement (If, IfExp) uses a test which is always constant, such as numbers,
408 classes, functions etc. This is most likely an error from the user's part.
409
410 Closes #524.
411
412 * Don't emit :ref:`raising-non-exception` when the exception has unknown
413 bases. We don't know what those bases actually are and it's better
414 to assume that the user knows what he is doing rather than emitting
415 a message which can be considered a false positive.
416
417 * Look for a .pylintrc configuration file in the current folder,
418 if pylintrc is not found. Dotted pylintrc files will not be searched
419 in the parents of the current folder, as it is done for pylintrc.
420
421 * Add a new error, 'invalid-unary-type-operand', emitted when
422 an unary operand is used on something which doesn't support that
423 operation (for instance, using the unary bitwise inversion operator
424 on an instance which doesn't implement __invert__).
425
426 * Take in consideration differences between arguments of various
427 type of functions (classmethods, staticmethods, properties)
428 when checking for ``arguments-differ``.
429
430 Closes #548.
431
432 * astroid.inspector was moved to pylint.pyreverse, since it belongs
433 there and it doesn't need to be in astroid.
434
435 * astroid.utils.LocalsVisitor was moved to pylint.pyreverse.LocalsVisitor.
436
437 * pylint.checkers.utils.excepts_import_error was removed.
438 Use pylint.checkers.utils.error_of_type instead.
439
440 * Don't emit undefined-all-variables for nodes which can't be
441 inferred (YES nodes).
442
443 * yield-outside-func is also emitted for ``yield from``.
444
445 * Add a new error, :ref:`too-many-star-expressions`, emitted when
446 there are more than one starred expression (`*x`) in an assignment.
447 The warning is emitted only on Python 3.
448
449 * Add a new error, :ref:`invalid-star-assignment-target`, emitted when
450 a starred expression (`*x`) is used as the lhs side of an assignment,
451 as in `*x = [1, 2]`. This is not a SyntaxError on Python 3 though.
452
453 * Detect a couple of objects which can't be base classes (bool,
454 slice, range and memoryview, which weren't detected until now).
455
456 * Add a new error for the Python 3 porting checker, ``import-star-module-level``,
457 which is used when a star import is detected in another scope than the
458 module level, which is an error on Python 3. Using this will emit a
459 SyntaxWarning on Python 2.
460
461 * Add a new error, :ref:`star-needs-assignment-target`, emitted on Python 3 when
462 a Starred expression (`*x`) is not used in an assignment target. This is not
463 caught when parsing the AST on Python 3, so it needs to be a separate check.
464
465 * Add a new error, :ref:`unsupported-binary-operation`, emitted when
466 two a binary arithmetic operation is executed between two objects
467 which don't support it (a number plus a string for instance).
468 This is currently disabled, since the it exhibits way too many false
469 positives, but it will be re-enabled as soon as possible.
470
471 * New imported features from astroid into pyreverse: pyreverse.inspector.Project,
472 pyreverse.inspector.project_from_files and pyreverse.inspector.interfaces.
473
474 These were moved since they didn't belong in astroid.
475
476 * Enable :ref:`misplaced-future` for Python 3.
477
478 Closes #580.
479
480 * Add a new error, :ref:`nonlocal-and-global`, which is emitted when a
481 name is found to be both nonlocal and global in the same scope.
482
483 Closes #581.
484
485 * ignored-classes option can work with qualified names (ignored-classes=optparse.Values)
486
487 Closes #297
488
489 * ignored-modules can work with qualified names as well as with Unix pattern
490 matching for recursive ignoring.
491
492 Closes #244
493
494 * Improve detection of relative imports in non-packages, as well as importing
495 missing modules with a relative import from a package.
496
497 * Don't emit no-init if not all the bases from a class are known.
498
499 Closes #604.
500
501 * --no-space-check option accepts ``empty-line`` as a possible option.
502
503 Closes #541.
504
505 * --generate-rcfile generates by default human readable symbols
506 for the --disable option.
507
508 Closes #608.
509
510 * Improved the :ref:`not-in-loop` checker to properly detect more cases.
511
512 * Add a new error, :ref:`continue-in-finally`, which is emitted when
513 the ``continue`` keyword is found inside a ``finally`` clause, which
514 is a SyntaxError.
515
516 * The --zope flag is deprecated and it is slated for removal
517 in Pylint 1.6.
518
519 The reason behind this removal is the fact that it's a specialized
520 flag and there are solutions for the original problem:
521 use --generated-members with the members that causes problems
522 when using Zope or add AST transforms tailored to the zope
523 project.
524
525 At the same time, --include-ids and --symbols will also be removed
526 in Pylint 1.6.
527
528 Closes #570.
529
530 * missing-module-attribute was removed and the corresponding
531 CLI option, required-attributes, which is slated for removal
532 in Pylint 1.6.
533
534 * missing-reversed-argument was removed.
535
536 The reason behind this is that this kind of errors should be
537 detected by the type checker for *all* the builtins and not
538 as a special case for the reversed builtin. This will happen
539 shortly in the future.
540
541 * --comment flag is obsolete and it will be removed in Pylint 1.6.
542
543 * --profile flag is obsolete and it will be removed in Pylint 1.6.
544
545 * Add a new error, :ref:`misplaced-bare-raise`.
546
547 The error is used when a bare raise is not used inside an except clause.
548 This can generate a RuntimeError in Python, if there are no active exceptions
549 to be reraised. While it works in Python 2 due to the fact that the exception
550 leaks outside of the except block, it's nevertheless a behaviour that
551 a user shouldn't depend upon, since it's not obvious to the reader of the code
552 what exception will be raised and it will not be compatible with Python 3 anyhow.
553
554 Closes #633.
555
556 * Bring logilab-common's ureports into pylint.reporters.
557
558 With this change, we moved away from depending on logilab-common,
559 having in Pylint all the components that were used from logilab-common.
560 The API should be considered an implementation detail and can change at
561 some point in the future.
562
563 Closes #621.
564
565 * ``reimported`` is emitted for reimported objects on the same line.
566
567 Closes #639.
568
569 * Abbreviations of command line options are not supported anymore.
570
571 Using abbreviations for CLI options was never considered to be
572 a feature of pylint, this fact being only a side effect of using optparse.
573 As this was the case, using --load-plugin or other abbreviation
574 for --load-plugins never actually worked, while it also didn't raise
575 an error.
576
577 Closes #424.
578
579 * Add a new error, :ref:`nonlocal-without-binding`
580
581 The error is emitted on Python 3 when a nonlocal name is not bound
582 to any variable in the parents scopes.
583
584 Closes #582.
585
586 * :ref:`deprecated-module` can be shown for modules which aren't
587 available.
588
589 Closes #362.
590
591 * Don't consider a class abstract if its members can't
592 be properly inferred.
593
594 This fixes a false positive related to :ref:`abstract-class-instantiated`.
595
596 Closes #648.
597
598 * Add a new checker for the async features added by PEP 492.
599
600 * Add a new error, :ref:`yield-inside-async-function`, emitted on
601 Python 3.5 and upwards when the ``yield`` statement is found inside
602 a new coroutine function (PEP 492).
603
604 * Add a new error, :ref:`not-async-context-manager`, emitted when
605 an async context manager block is used with an object which doesn't
606 support this protocol (PEP 492).
607
608 * Add a new convention warning, :ref:`singleton-comparison`, emitted when
609 comparison to True, False or None is found.
610
611 * Don't emit :ref:`assigning-non-slot` for descriptors.
612
613 Closes #652.
614
615 * Add a new error, :ref:`repeated-keyword`, when a keyword argument is passed
616 multiple times into a function call.
617
618 This is similar with :ref:`redundant-keyword-arg`, but it's mildly different
619 that it needs to be a separate error.
620
621 * --enable=all can now be used.
622
623 Closes #142.
624
625 * Add a new convention message, :ref:`misplaced-comparison-constant`,
626 emitted when a constant is placed in the left hand side of a comparison,
627 as in '5 == func()'. This is also called Yoda condition, since the
628 flow of code reminds of the Star Wars green character, conditions usually
629 encountered in languages with variabile assignments in conditional
630 statements.
631
632 * Add a new convention message, :ref:`consider-using-enumerate`, which is
633 emitted when code that uses ``range`` and ``len`` for iterating is encountered.
634
635 Closes #684.
636
637 * Added two new refactoring messages, :ref:`no-classmethod-decorator` and
638 :ref:`no-staticmethod-decorator`, which are emitted when a static method or a class
639 method is declared without using decorators syntax.
640
641 Closes #675.