Debian Codegraph @

doc/whatsnew/2/2.14/full.rst

raw
1 Full changelog
2 ==============
3
4
5 What's New in Pylint 2.14.5?
6 ----------------------------
7 Release date: 2022-07-17
8
9
10 * Fixed a crash in the ``undefined-loop-variable`` check when ``enumerate()`` is used
11 in a ternary expression.
12
13 Closes #7131
14
15 * Fixed handling of ``--`` as separator between positional arguments and flags.
16
17 Closes #7003
18
19 * Fixed the disabling of ``fixme`` and its interaction with ``useless-suppression``.
20
21 * Allow lists of default values in parameter documentation for ``Numpy`` style.
22
23 Closes #4035
24
25
26 What's New in Pylint 2.14.4?
27 ----------------------------
28 Release date: 2022-06-29
29
30 * The ``differing-param-doc`` check was triggered by positional only arguments.
31
32 Closes #6950
33
34 * Fixed an issue where scanning `.` directory recursively with ``--ignore-path=^path/to/dir`` is not
35 ignoring the `path/to/dir` directory.
36
37 Closes #6964
38
39 * Fixed regression that didn't allow quoted ``init-hooks`` in option files.
40
41 Closes #7006
42
43 * Fixed a false positive for ``modified-iterating-dict`` when updating an existing key.
44
45 Closes #6179
46
47 * Fixed an issue where many-core Windows machines (>~60 logical processors) would hang when
48 using the default jobs count.
49
50 Closes #6965
51
52 * Fixed an issue with the recognition of ``setup.cfg`` files.
53 Only ``.cfg`` files that are exactly named ``setup.cfg`` require section names that
54 start with ``pylint.``.
55
56 Closes #3630
57
58 * Don't report ``import-private-name`` for relative imports.
59
60 Closes #7078
61
62
63 What's New in Pylint 2.14.3?
64 ----------------------------
65 Release date: 2022-06-18
66
67 * Fixed two false positives for ``bad-super-call`` for calls that refer to a non-direct parent.
68
69 Closes #4922, Closes #2903
70
71 * Fixed a false positive for ``useless-super-delegation`` for subclasses that specify the number of
72 of parameters against a parent that uses a variadic argument.
73
74 Closes #2270
75
76 * Allow suppressing ``undefined-loop-variable`` and ``undefined-variable`` without raising ``useless-suppression``.
77
78 * Fixed false positive for ``undefined-variable`` for ``__class__`` in inner methods.
79
80 Closes #4032
81
82
83 What's New in Pylint 2.14.2?
84 ----------------------------
85 Release date: 2022-06-15
86
87 * Fixed a false positive for ``unused-variable`` when a function returns an
88 ``argparse.Namespace`` object.
89
90 Closes #6895
91
92 * Avoided raising an identical ``undefined-loop-variable`` message twice on the same line.
93
94 * Don't crash if ``lint.run._query_cpu()`` is run within a Kubernetes Pod, that has only
95 a fraction of a cpu core assigned. Just go with one process then.
96
97 Closes #6902
98
99 * Fixed a false positive in ``consider-using-f-string`` if the left side of a ``%`` is not a string.
100
101 Closes #6689
102
103 * Fixed a false positive in ``unnecessary-list-index-lookup`` and ``unnecessary-dict-index-lookup``
104 when the subscript is updated in the body of a nested loop.
105
106 Closes #6818
107
108 * Fixed an issue with multi-line ``init-hook`` options which did not record the line endings.
109
110 Closes #6888
111
112 * Fixed a false positive for ``used-before-assignment`` when a try block returns
113 but an except handler defines a name via type annotation.
114
115 * ``--errors-only`` no longer enables previously disabled messages. It was acting as
116 "emit *all* and only error messages" without being clearly documented that way.
117
118 Closes #6811
119
120
121 What's New in Pylint 2.14.1?
122 ----------------------------
123 Release date: 2022-06-06
124
125 * Avoid reporting ``unnecessary-dict-index-lookup`` or ``unnecessary-list-index-lookup``
126 when the index lookup is part of a destructuring assignment.
127
128 Closes #6788
129
130 * Fixed parsing of unrelated options in ``tox.ini``.
131
132 Closes #6800
133
134 * Fixed a crash when linting ``__new__()`` methods that return a call expression.
135
136 Closes #6805
137
138 * Don't crash if we can't find the user's home directory.
139
140 Closes #6802
141
142 * Fixed false positives for ``unused-import`` when aliasing ``typing`` e.g. as ``t``
143 and guarding imports under ``t.TYPE_CHECKING``.
144
145 Closes #3846
146
147 * Fixed a false positive regression in 2.13 for ``used-before-assignment`` where it is safe to rely
148 on a name defined only in an ``except`` block because the ``else`` block returned.
149
150 Closes #6790
151
152 * Fixed the use of abbreviations for some special options on the command line.
153
154 Closes #6810
155
156 * Fix a crash in the optional ``pylint.extensions.private_import`` extension.
157
158 Closes #6624
159
160 * ``bad-option-value`` (E0012) is now a warning ``unknown-option-value`` (W0012). Deleted messages that do not exist
161 anymore in pylint now raise ``useless-option-value`` (R0022) instead of ``bad-option-value``. This allows to
162 distinguish between genuine typos and configuration that could be cleaned up. Existing message disables for
163 ``bad-option-value`` will still work on both new messages.
164
165 Refs #6794
166
167
168 What's New in Pylint 2.14.0?
169 ----------------------------
170 Release date: 2022-06-01
171
172
173 * The refactoring checker now also raises :ref:`consider-using-generator`' messages for
174 ``max()``, ``min()`` and ``sum()``.
175
176 Refs #6595
177
178 * We have improved our recognition of inline disable and enable comments. It is
179 now possible to disable ``bad-option-value`` inline (as long as you disable it before
180 the bad option value is raised, i.e. ``disable=bad-option-value,bad-message`` not ``disable=bad-message,bad-option-value`` ) as well as certain other previously unsupported messages.
181
182 Closes #3312
183
184 * Fixed a crash in the ``unused-private-member`` checker involving chained private attributes.
185
186 Closes #6709
187
188 * Added new checker ``comparison-of-constants``.
189
190 Closes #6076
191
192 * ``pylint.pyreverse.ASTWalker`` has been removed, as it was only used internally by a single child class.
193
194 Refs #6712
195
196 * ``pyreverse``: Resolving and displaying implemented interfaces that are defined by the ``__implements__``
197 attribute has been deprecated and will be removed in 3.0.
198
199 Refs #6713
200
201 * Fix syntax for return type annotations in MermaidJS diagrams produced with ``pyreverse``.
202
203 Closes #6467
204
205 * Fix type annotations of class and instance attributes using the alternative union syntax in ``pyreverse`` diagrams.
206
207 * Fix ``unexpected-special-method-signature`` false positive for ``__init_subclass__`` methods with one or more arguments.
208
209 Closes #6644
210
211 * Started ignoring underscore as a local variable for ``too-many-locals``.
212
213 Closes #6488
214
215 * Improved wording of the message of ``deprecated-module``
216
217 Closes #6169
218
219 * ``Pylint`` now requires Python 3.7.2 or newer to run.
220
221 Closes #4301
222
223 * ``BaseChecker`` classes now require the ``linter`` argument to be passed.
224
225 * Fix a failure to respect inline disables for ``fixme`` occurring on the last line
226 of a module when pylint is launched with ``--enable=fixme``.
227
228 * Update ``invalid-slots-object`` message to show bad object rather than its inferred value.
229
230 Closes #6101
231
232 * The main checker name is now ``main`` instead of ``master``. The configuration does not need to be updated as sections' name are optional.
233
234 Closes #5467
235
236 * Don't report ``useless-super-delegation`` for the ``__hash__`` method in classes that also override the ``__eq__`` method.
237
238 Closes #3934
239
240 * Added new checker ``typevar-name-mismatch``: TypeVar must be assigned to a variable with the same name as its name argument.
241
242 Closes #5224
243
244 * Pylint can now be installed with an extra-require called ``spelling`` (``pip install pylint[spelling]``).
245 This will add ``pyenchant`` to pylint's dependencies. You will still need to install the
246 requirements for ``pyenchant`` (the ``enchant`` library and any dictionaries) yourself. You will also
247 need to set the ``spelling-dict`` option.
248
249 Refs #6462
250
251 * Removed the ``assign-to-new-keyword`` message as there are no new keywords in the supported Python
252 versions any longer.
253
254 Closes #4683
255
256 * Fixed a crash in the ``not-an-iterable`` checker involving multiple starred expressions
257 inside a call.
258
259 Closes #6372
260
261 * Fixed a crash in the ``docparams`` extension involving raising the result of a function.
262
263 * Fixed failure to enable ``deprecated-module`` after a ``disable=all``
264 by making ``ImportsChecker`` solely responsible for emitting ``deprecated-module`` instead
265 of sharing responsibility with ``StdlibChecker``. (This could have led to double messages.)
266
267 * The ``no-init`` (W0232) warning has been removed. It's ok to not have an ``__init__`` in a class.
268
269 Closes #2409
270
271 * The ``config`` attribute of ``BaseChecker`` has been deprecated. You can use ``checker.linter.config``
272 to access the global configuration object instead of a checker-specific object.
273
274 Refs #5392
275
276 * The ``level`` attribute of ``BaseChecker`` has been deprecated: everything is now
277 displayed in ``--help``, all the time.
278
279 Refs #5392
280
281 * The ``options_providers`` attribute of ``ArgumentsManager`` has been deprecated.
282
283 Refs #5392
284
285 * The ``option_groups`` attribute of ``PyLinter`` has been deprecated.
286
287 Refs #5392
288
289 * All ``Interface`` classes in ``pylint.interfaces`` have been deprecated. You can subclass
290 the respective normal classes to get the same behaviour. The ``__implements__`` functionality
291 was based on a rejected PEP from 2001:
292 https://peps.python.org/pep-0245/
293
294 Closes #2287
295
296 * The ``set_option`` method of ``BaseChecker`` has been deprecated. You can use ``checker.linter.set_option``
297 to set an option on the global configuration object instead of a checker-specific object.
298
299 Refs #5392
300
301 * ``implicit-str-concat`` will now be raised on calls like ``open("myfile.txt" "a+b")`` too.
302
303 Closes #6441
304
305 * The ``config`` attribute of ``PyLinter`` is now of the ``argparse.Namespace`` type instead of
306 ``optparse.Values``.
307
308 Refs #5392
309
310 * ``MapReduceMixin`` has been deprecated. ``BaseChecker`` now implements ``get_map_data`` and
311 ``reduce_map_data``. If a checker actually needs to reduce data it should define ``get_map_data``
312 as returning something different than ``None`` and let its ``reduce_map_data`` handle a list
313 of the types returned by ``get_map_data``.
314 An example can be seen by looking at ``pylint/checkers/similar.py``.
315
316 * ``UnsupportedAction`` has been deprecated.
317
318 Refs #5392
319
320 * ``OptionsManagerMixIn`` has been deprecated.
321
322 Refs #5392
323
324 * ``OptionParser`` has been deprecated.
325
326 Refs #5392
327
328 * ``Option`` has been deprecated.
329
330 Refs #5392
331
332 * ``OptionsProviderMixIn`` has been deprecated.
333
334 Refs #5392
335
336 * ``ConfigurationMixIn`` has been deprecated.
337
338 Refs #5392
339
340 * ``get_global_config`` has been deprecated. You can now access all global options from
341 ``checker.linter.config``.
342
343 Refs #5392
344
345 * ``OptionsManagerMixIn`` has been replaced with ``ArgumentsManager``. ``ArgumentsManager`` is considered
346 private API and most methods that were public on ``OptionsManagerMixIn`` have now been deprecated and will
347 be removed in a future release.
348
349 Refs #5392
350
351 * ``OptionsProviderMixIn`` has been replaced with ``ArgumentsProvider``. ``ArgumentsProvider`` is considered
352 private API and most methods that were public on ``OptionsProviderMixIn`` have now been deprecated and will
353 be removed in a future release.
354
355 Refs #5392
356
357 * ``interfaces.implements`` has been deprecated and will be removed in 3.0. Please use standard inheritance
358 patterns instead of ``__implements__``.
359
360 Refs #2287
361
362 * ``invalid-enum-extension``: Used when a class tries to extend an inherited Enum class.
363
364 Closes #5501
365
366 * Added the ``unrecognized-option`` message. Raised if we encounter any unrecognized options.
367
368 Closes #5259
369
370 * Added new checker ``typevar-double-variance``: The "covariant" and "contravariant" keyword arguments
371 cannot both be set to "True" in a TypeVar.
372
373 Closes #5895
374
375 * Re-enable checker ``bad-docstring-quotes`` for Python <= 3.7.
376
377 Closes #6087
378
379 * Removed the broken ``generate-man`` option.
380
381 Closes #5283
382 Closes #1887
383
384 * Fix false negative for ``bad-string-format-type`` if the value to be formatted is passed in
385 as a variable holding a constant.
386
387 * Add new check ``unnecessary-dunder-call`` for unnecessary dunder method calls.
388
389 Closes #5936
390 Closes #6074
391
392 * The ``cache-max-size-none`` checker has been renamed to ``method-cache-max-size-none``.
393
394 Closes #5670
395
396 * The ``method-cache-max-size-none`` checker will now also check ``functools.cache``.
397
398 Closes #5670
399
400 * ``unnecessary-lambda-assignment``: Lambda expression assigned to a variable.
401 Define a function using the "def" keyword instead.
402 ``unnecessary-direct-lambda-call``: Lambda expression called directly.
403 Execute the expression inline instead.
404
405 Closes #5976
406
407 * ``potential-index-error``: Emitted when the index of a list or tuple exceeds its length.
408 This checker is currently quite conservative to avoid false positives. We welcome
409 suggestions for improvements.
410
411 Closes #578
412
413 * Added optional extension ``redefined-loop-name`` to emit messages when a loop variable
414 is redefined in the loop body.
415
416 Closes #5072
417
418 * Changed message type from ``redefined-outer-name`` to ``redefined-loop-name``
419 (optional extension) for redefinitions of outer loop variables by inner loops.
420
421 Closes #5608
422
423 * The ``ignore-mixin-members`` option has been deprecated. You should now use the new
424 ``ignored-checks-for-mixins`` option.
425
426 Closes #5205
427
428 * ``bad-option-value`` will be emitted whenever a configuration value or command line invocation
429 includes an unknown message.
430
431 Closes #4324
432
433 * Avoid reporting ``superfluous-parens`` on expressions using the ``is not`` operator.
434
435 Closes #5930
436
437 * Added the ``super-without-brackets`` checker, raised when a super call is missing its brackets.
438
439 Closes #4008
440
441 * Added the ``generate-toml-config`` option.
442
443 Refs #5462
444
445 * Added new checker ``unnecessary-list-index-lookup`` for indexing into a list while
446 iterating over ``enumerate()``.
447
448 Closes #4525
449
450 * Fix falsely issuing ``useless-suppression`` on the ``wrong-import-position`` checker.
451
452 Closes #5219
453
454 * Fixed false positive ``no-member`` for Enums with self-defined members.
455
456 Closes #5138
457
458 * Fix false negative for ``no-member`` when attempting to assign an instance
459 attribute to itself without any prior assignment.
460
461 Closes #1555
462
463 * The concept of checker priority has been removed.
464
465 * Add a new command line option ``--minimal-messages-config`` for ``pytest``, which disables all
466 irrelevant messages when running the functional tests.
467
468 * ``duplicate-argument-name`` now only raises once for each set of duplicated arguments.
469
470 * Fix bug where specifically enabling just ``await-outside-async`` was not possible.
471
472 * The ``set_config_directly`` decorator has been removed.
473
474 * Added new message called ``duplicate-value`` which identifies duplicate values inside sets.
475
476 Closes #5880
477
478 * Pylint now expands the user path (i.e. ``~`` to ``home/yusef/``) and expands environment variables (i.e. ``home/$USER/$project``
479 to ``home/yusef/pylint`` for ``USER=yusef`` and ``project=pylint``) for pyreverse's ``output-directory``,
480 ``import-graph``, ``ext-import-graph``, ``int-import-graph`` options, and the spell checker's ``spelling-private-dict-file``
481 option.
482
483 Refs #6493
484
485 * Created ``NoSelfUseChecker`` extension and moved the ``no-self-use`` check.
486 You now need to explicitly enable this check using
487 ``load-plugins=pylint.extensions.no_self_use``.
488
489 Closes #5502
490
491 * Fix saving of persistent data files in environments where the user's cache
492 directory and the linted file are on a different drive.
493
494 Closes #6394
495
496 * Don't emit ``unsubscriptable-object`` for string annotations.
497 Pylint doesn't check if class is only generic in type stubs only.
498
499 Closes #4369 and #6523
500
501 * Fix pyreverse crash ``RuntimeError: dictionary changed size during iteration``
502
503 Refs #6612
504
505 * Fix bug where it writes a plain text error message to stdout, invalidating output formats.
506
507 Closes #6597
508
509 * ``is_class_subscriptable_pep585_with_postponed_evaluation_enabled`` has been deprecated.
510 Use ``is_postponed_evaluation_enabled(node) and is_node_in_type_annotation_context(node)``
511 instead.
512
513 Refs #6536
514
515 * Update ranges for ``using-constant-test`` and ``missing-parentheses-for-call-in-test``
516 error messages.
517
518 * Don't emit ``no-member`` inside type annotations with
519 ``from __future__ import annotations``.
520
521 Closes #6594