| 1 |
*************************** |
| 2 |
What's New in Pylint 2.17 |
| 3 |
*************************** |
| 4 |
|
| 5 |
.. toctree:: |
| 6 |
:maxdepth: 2 |
| 7 |
|
| 8 |
:Release: 2.17 |
| 9 |
:Date: 2023-03-08 |
| 10 |
|
| 11 |
Summary -- Release highlights |
| 12 |
============================= |
| 13 |
|
| 14 |
2.17 is a small release that is the first to support python 3.11 |
| 15 |
officially with the addition of TryStar nodes. |
| 16 |
|
| 17 |
There's still two new default checks: ``bad-chained-comparison`` and |
| 18 |
``implicit-flag-alias``, one of them already fixed a previously |
| 19 |
undetected bug in sentry. |
| 20 |
|
| 21 |
Thanks to the community effort our documentation is almost complete, |
| 22 |
and every messages should have a proper documentation now. A big thank |
| 23 |
you to everyone who participated ! |
| 24 |
|
| 25 |
The next release is going to be ``3.0.0``, bring breaking changes and enact long |
| 26 |
announced deprecations. There's going to be frequent beta releases, |
| 27 |
before the official releases, everyone is welcome to try the betas |
| 28 |
so we find problems before the actual release. |
| 29 |
|
| 30 |
.. towncrier release notes start |
| 31 |
|
| 32 |
What's new in Pylint 2.17.7? |
| 33 |
---------------------------- |
| 34 |
Release date: 2023-09-30 |
| 35 |
|
| 36 |
|
| 37 |
False Positives Fixed |
| 38 |
--------------------- |
| 39 |
|
| 40 |
- Fix a regression in pylint 2.17.6 / astroid 2.15.7 causing various |
| 41 |
messages for code involving ``TypeVar``. |
| 42 |
|
| 43 |
Closes #9069 (`#9069 <https://github.com/pylint-dev/pylint/issues/9069>`_) |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
Other Bug Fixes |
| 48 |
--------------- |
| 49 |
|
| 50 |
- Fix crash in refactoring checker when unary operand used with variable in for |
| 51 |
loop. |
| 52 |
|
| 53 |
Closes #9074 (`#9074 <https://github.com/pylint-dev/pylint/issues/9074>`_) |
| 54 |
|
| 55 |
|
| 56 |
What's new in Pylint 2.17.6? |
| 57 |
---------------------------- |
| 58 |
Release date: 2023-09-24 |
| 59 |
|
| 60 |
|
| 61 |
Other Bug Fixes |
| 62 |
--------------- |
| 63 |
|
| 64 |
- When parsing comma-separated lists of regular expressions in the config, |
| 65 |
ignore |
| 66 |
commas that are inside braces since those indicate quantifiers, not |
| 67 |
delineation |
| 68 |
between expressions. |
| 69 |
|
| 70 |
Closes #7229 (`#7229 <https://github.com/pylint-dev/pylint/issues/7229>`_) |
| 71 |
|
| 72 |
- ``sys.argv`` is now always correctly considered as impossible to infer |
| 73 |
(instead of |
| 74 |
using the actual values given to pylint). |
| 75 |
|
| 76 |
Closes #7710 (`#7710 <https://github.com/pylint-dev/pylint/issues/7710>`_) |
| 77 |
|
| 78 |
- Don't show class fields more than once in Pyreverse diagrams. |
| 79 |
|
| 80 |
Closes #8189 (`#8189 <https://github.com/pylint-dev/pylint/issues/8189>`_) |
| 81 |
|
| 82 |
- Don't show arrows more than once in Pyreverse diagrams. |
| 83 |
|
| 84 |
Closes #8522 (`#8522 <https://github.com/pylint-dev/pylint/issues/8522>`_) |
| 85 |
|
| 86 |
- Don't show duplicate type annotations in Pyreverse diagrams. |
| 87 |
|
| 88 |
Closes #8888 (`#8888 <https://github.com/pylint-dev/pylint/issues/8888>`_) |
| 89 |
|
| 90 |
- Don't add `Optional` to `|` annotations with `None` in Pyreverse diagrams. |
| 91 |
|
| 92 |
Closes #9014 (`#9014 <https://github.com/pylint-dev/pylint/issues/9014>`_) |
| 93 |
|
| 94 |
|
| 95 |
What's new in Pylint 2.17.5? |
| 96 |
---------------------------- |
| 97 |
Release date: 2023-07-26 |
| 98 |
|
| 99 |
|
| 100 |
False Positives Fixed |
| 101 |
--------------------- |
| 102 |
|
| 103 |
- Fix a false positive for ``unused-variable`` when there is an import in a |
| 104 |
``if TYPE_CHECKING:`` block and ``allow-global-unused-variables`` is set to |
| 105 |
``no`` in the configuration. |
| 106 |
|
| 107 |
Closes #8696 (`#8696 <https://github.com/pylint-dev/pylint/issues/8696>`_) |
| 108 |
|
| 109 |
- Fix false positives generated when supplying arguments as ``**kwargs`` to IO |
| 110 |
calls like open(). |
| 111 |
|
| 112 |
Closes #8719 (`#8719 <https://github.com/pylint-dev/pylint/issues/8719>`_) |
| 113 |
|
| 114 |
- Fix a false positive where pylint was ignoring method calls annotated as |
| 115 |
``NoReturn`` during the ``inconsistent-return-statements`` check. |
| 116 |
|
| 117 |
Closes #8747 (`#8747 <https://github.com/pylint-dev/pylint/issues/8747>`_) |
| 118 |
|
| 119 |
- Exempt parents with only type annotations from the ``invalid-enum-extension`` |
| 120 |
message. |
| 121 |
|
| 122 |
Closes #8830 (`#8830 <https://github.com/pylint-dev/pylint/issues/8830>`_) |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
Other Bug Fixes |
| 127 |
--------------- |
| 128 |
|
| 129 |
- Fixed crash when a call to ``super()`` was placed after an operator (e.g. |
| 130 |
``not``). |
| 131 |
|
| 132 |
Closes #8554 (`#8554 <https://github.com/pylint-dev/pylint/issues/8554>`_) |
| 133 |
|
| 134 |
- Fix crash for ``modified-while-iterating`` checker when deleting |
| 135 |
members of a dict returned from a call. |
| 136 |
|
| 137 |
Closes #8598 (`#8598 <https://github.com/pylint-dev/pylint/issues/8598>`_) |
| 138 |
|
| 139 |
- Fix crash in ``invalid-metaclass`` check when a metaclass had duplicate |
| 140 |
bases. |
| 141 |
|
| 142 |
Closes #8698 (`#8698 <https://github.com/pylint-dev/pylint/issues/8698>`_) |
| 143 |
|
| 144 |
- Avoid ``consider-using-f-string`` on modulos with brackets in template. |
| 145 |
|
| 146 |
Closes #8720. (`#8720 <https://github.com/pylint-dev/pylint/issues/8720>`_) |
| 147 |
|
| 148 |
- Fix a crash when ``__all__`` exists but cannot be inferred. |
| 149 |
|
| 150 |
Closes #8740 (`#8740 <https://github.com/pylint-dev/pylint/issues/8740>`_) |
| 151 |
|
| 152 |
- Fix crash when a variable is assigned to a class attribute of identical name. |
| 153 |
|
| 154 |
Closes #8754 (`#8754 <https://github.com/pylint-dev/pylint/issues/8754>`_) |
| 155 |
|
| 156 |
- Fixed a crash when calling ``copy.copy()`` without arguments. |
| 157 |
|
| 158 |
Closes #8774 (`#8774 <https://github.com/pylint-dev/pylint/issues/8774>`_) |
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
Other Changes |
| 163 |
------------- |
| 164 |
|
| 165 |
- Fix a crash when a ``nonlocal`` is defined at module-level. |
| 166 |
|
| 167 |
Closes #8735 (`#8735 <https://github.com/pylint-dev/pylint/issues/8735>`_) |
| 168 |
|
| 169 |
|
| 170 |
What's new in Pylint 2.17.4? |
| 171 |
---------------------------- |
| 172 |
Release date: 2023-05-06 |
| 173 |
|
| 174 |
|
| 175 |
False Positives Fixed |
| 176 |
--------------------- |
| 177 |
|
| 178 |
- Fix a false positive for ``bad-dunder-name`` when there is a user-defined |
| 179 |
``__index__`` method. |
| 180 |
|
| 181 |
Closes #8613 (`#8613 <https://github.com/pylint-dev/pylint/issues/8613>`_) |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
Other Bug Fixes |
| 186 |
--------------- |
| 187 |
|
| 188 |
- ``pyreverse``: added escaping of vertical bar character in annotation labels |
| 189 |
produced by DOT printer to ensure it is not treated as field separator of |
| 190 |
record-based nodes. |
| 191 |
|
| 192 |
Closes #8603 (`#8603 <https://github.com/pylint-dev/pylint/issues/8603>`_) |
| 193 |
|
| 194 |
- Fixed a crash when generating a configuration file: |
| 195 |
``tomlkit.exceptions.TOMLKitError: Can't add a table to a dotted key`` |
| 196 |
caused by tomlkit ``v0.11.8``. |
| 197 |
|
| 198 |
Closes #8632 (`#8632 <https://github.com/pylint-dev/pylint/issues/8632>`_) |
| 199 |
|
| 200 |
|
| 201 |
What's new in Pylint 2.17.3? |
| 202 |
---------------------------- |
| 203 |
Release date: 2023-04-24 |
| 204 |
|
| 205 |
|
| 206 |
False Positives Fixed |
| 207 |
--------------------- |
| 208 |
|
| 209 |
- Fix `unused-argument` false positive when `__new__` does not use all the |
| 210 |
arguments of `__init__`. |
| 211 |
|
| 212 |
Closes #3670 (`#3670 <https://github.com/pylint-dev/pylint/issues/3670>`_) |
| 213 |
|
| 214 |
- Fix ``unused-import`` false positive for usage of ``six.with_metaclass``. |
| 215 |
|
| 216 |
Closes #7506 (`#7506 <https://github.com/pylint-dev/pylint/issues/7506>`_) |
| 217 |
|
| 218 |
- `logging-not-lazy` is not longer emitted for explicitly concatenated string |
| 219 |
arguments. |
| 220 |
|
| 221 |
Closes #8410 (`#8410 <https://github.com/pylint-dev/pylint/issues/8410>`_) |
| 222 |
|
| 223 |
- Fix false positive for :ref:`isinstance-second-argument-not-valid-type` when union |
| 224 |
types contains None. |
| 225 |
|
| 226 |
Closes #8424 (`#8424 <https://github.com/pylint-dev/pylint/issues/8424>`_) |
| 227 |
|
| 228 |
- Fixed `unused-import` so that it observes the `dummy-variables-rgx` option. |
| 229 |
|
| 230 |
Closes #8500 (`#8500 <https://github.com/pylint-dev/pylint/issues/8500>`_) |
| 231 |
|
| 232 |
- `Union` typed variables without assignment are no longer treated as |
| 233 |
`TypeAlias`. |
| 234 |
|
| 235 |
Closes #8540 (`#8540 <https://github.com/pylint-dev/pylint/issues/8540>`_) |
| 236 |
|
| 237 |
- Fix false positive for ``positional-only-arguments-expected`` when a function |
| 238 |
contains both a positional-only parameter that has a default value, and |
| 239 |
``**kwargs``. |
| 240 |
|
| 241 |
Closes #8555 (`#8555 <https://github.com/pylint-dev/pylint/issues/8555>`_) |
| 242 |
|
| 243 |
- Fix false positive for ``keyword-arg-before-vararg`` when a positional-only |
| 244 |
parameter with a default value precedes ``*args``. |
| 245 |
|
| 246 |
Closes #8570 (`#8570 <https://github.com/pylint-dev/pylint/issues/8570>`_) |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
Other Bug Fixes |
| 251 |
--------------- |
| 252 |
|
| 253 |
- Improve output of ``consider-using-generator`` message for ``min()`` calls |
| 254 |
with ``default`` keyword. |
| 255 |
|
| 256 |
Closes #8563 (`#8563 <https://github.com/pylint-dev/pylint/issues/8563>`_) |
| 257 |
|
| 258 |
|
| 259 |
What's new in Pylint 2.17.2? |
| 260 |
---------------------------- |
| 261 |
Release date: 2023-04-03 |
| 262 |
|
| 263 |
|
| 264 |
False Positives Fixed |
| 265 |
--------------------- |
| 266 |
|
| 267 |
- ``invalid-name`` now allows for integers in ``typealias`` names: |
| 268 |
- now valid: ``Good2Name``, ``GoodName2``. |
| 269 |
- still invalid: ``_1BadName``. |
| 270 |
|
| 271 |
Closes #8485 (`#8485 <https://github.com/pylint-dev/pylint/issues/8485>`_) |
| 272 |
|
| 273 |
- No longer consider ``Union`` as type annotation as type alias for naming |
| 274 |
checks. |
| 275 |
|
| 276 |
Closes #8487 (`#8487 <https://github.com/pylint-dev/pylint/issues/8487>`_) |
| 277 |
|
| 278 |
- ``unnecessary-lambda`` no longer warns on lambdas which use its parameters in |
| 279 |
their body (other than the final arguments), e.g. |
| 280 |
``lambda foo: (bar if foo else baz)(foo)``. |
| 281 |
|
| 282 |
Closes #8496 (`#8496 <https://github.com/pylint-dev/pylint/issues/8496>`_) |
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
Other Bug Fixes |
| 287 |
--------------- |
| 288 |
|
| 289 |
- Fix a crash in pyreverse when "/" characters are used in the output filename |
| 290 |
e.g pyreverse -o png -p name/ path/to/project. |
| 291 |
|
| 292 |
Closes #8504 (`#8504 <https://github.com/pylint-dev/pylint/issues/8504>`_) |
| 293 |
|
| 294 |
|
| 295 |
What's new in Pylint 2.17.1? |
| 296 |
---------------------------- |
| 297 |
Release date: 2023-03-22 |
| 298 |
|
| 299 |
|
| 300 |
False Positives Fixed |
| 301 |
--------------------- |
| 302 |
|
| 303 |
- Adds ``asyncSetUp`` to the default ``defining-attr-methods`` list to silence |
| 304 |
``attribute-defined-outside-init`` warning when using |
| 305 |
``unittest.IsolatedAsyncioTestCase``. |
| 306 |
|
| 307 |
Refs #8403 (`#8403 <https://github.com/pylint-dev/pylint/issues/8403>`_) |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
Other Bug Fixes |
| 312 |
--------------- |
| 313 |
|
| 314 |
- ``--clear-cache-post-run`` now also clears LRU caches for pylint utilities |
| 315 |
holding references to AST nodes. |
| 316 |
|
| 317 |
Closes #8361 (`#8361 <https://github.com/pylint-dev/pylint/issues/8361>`_) |
| 318 |
|
| 319 |
- Fix a crash when ``TYPE_CHECKING`` is used without importing it. |
| 320 |
|
| 321 |
Closes #8434 (`#8434 <https://github.com/pylint-dev/pylint/issues/8434>`_) |
| 322 |
|
| 323 |
- Fix a regression of ``preferred-modules`` where a partial match was used |
| 324 |
instead of the required full match. |
| 325 |
|
| 326 |
Closes #8453 (`#8453 <https://github.com/pylint-dev/pylint/issues/8453>`_) |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
Internal Changes |
| 331 |
---------------- |
| 332 |
|
| 333 |
- The following utilities are deprecated in favor of the more robust |
| 334 |
``in_type_checking_block`` |
| 335 |
and will be removed in pylint 3.0: |
| 336 |
|
| 337 |
- ``is_node_in_guarded_import_block`` |
| 338 |
- ``is_node_in_typing_guarded_import_block`` |
| 339 |
- ``is_typing_guard`` |
| 340 |
|
| 341 |
``is_sys_guard`` is still available, which was part of |
| 342 |
``is_node_in_guarded_import_block``. |
| 343 |
|
| 344 |
Refs #8433 (`#8433 <https://github.com/pylint-dev/pylint/issues/8433>`_) |
| 345 |
|
| 346 |
|
| 347 |
What's new in Pylint 2.17.0? |
| 348 |
---------------------------- |
| 349 |
Release date: 2023-03-08 |
| 350 |
|
| 351 |
|
| 352 |
New Features |
| 353 |
------------ |
| 354 |
|
| 355 |
- `pyreverse` now supports custom color palettes with the `--color-palette` |
| 356 |
option. |
| 357 |
|
| 358 |
Closes #6738 (`#6738 <https://github.com/pylint-dev/pylint/issues/6738>`_) |
| 359 |
|
| 360 |
- Add ``invalid-name`` check for ``TypeAlias`` names. |
| 361 |
|
| 362 |
Closes #7081. (`#7081 <https://github.com/pylint-dev/pylint/issues/7081>`_) |
| 363 |
|
| 364 |
- Accept values of the form ``<class name>.<attribute name>`` for the |
| 365 |
``exclude-protected`` list. |
| 366 |
|
| 367 |
Closes #7343 (`#7343 <https://github.com/pylint-dev/pylint/issues/7343>`_) |
| 368 |
|
| 369 |
- Add `--version` option to `pyreverse`. |
| 370 |
|
| 371 |
Refs #7851 (`#7851 <https://github.com/pylint-dev/pylint/issues/7851>`_) |
| 372 |
|
| 373 |
- Adds new functionality with preferred-modules configuration to detect |
| 374 |
submodules. |
| 375 |
|
| 376 |
Refs #7957 (`#7957 <https://github.com/pylint-dev/pylint/issues/7957>`_) |
| 377 |
|
| 378 |
- Support implicit namespace packages (PEP 420). |
| 379 |
|
| 380 |
Closes #8154 (`#8154 <https://github.com/pylint-dev/pylint/issues/8154>`_) |
| 381 |
|
| 382 |
- Add globbing pattern support for ``--source-roots``. |
| 383 |
|
| 384 |
Closes #8290 (`#8290 <https://github.com/pylint-dev/pylint/issues/8290>`_) |
| 385 |
|
| 386 |
- Support globbing pattern when defining which file/directory/module to lint. |
| 387 |
|
| 388 |
Closes #8310 (`#8310 <https://github.com/pylint-dev/pylint/issues/8310>`_) |
| 389 |
|
| 390 |
- pylint now supports ``TryStar`` nodes from Python 3.11 and should be fully |
| 391 |
compatible with Python 3.11. |
| 392 |
|
| 393 |
Closes #8387 (`#8387 <https://github.com/pylint-dev/pylint/issues/8387>`_) |
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
New Checks |
| 398 |
---------- |
| 399 |
|
| 400 |
- Add a ``bad-chained-comparison`` check that emits a warning when |
| 401 |
there is a chained comparison where one expression is semantically |
| 402 |
incompatible with the other. |
| 403 |
|
| 404 |
Closes #6559 (`#6559 <https://github.com/pylint-dev/pylint/issues/6559>`_) |
| 405 |
|
| 406 |
- Adds an ``implicit-flag-alias`` check that emits a warning when a class |
| 407 |
derived from ``enum.IntFlag`` assigns distinct integer values that share |
| 408 |
common bit positions. |
| 409 |
|
| 410 |
Refs #8102 (`#8102 <https://github.com/pylint-dev/pylint/issues/8102>`_) |
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
False Positives Fixed |
| 415 |
--------------------- |
| 416 |
|
| 417 |
- Fix various false positives for functions that return directly from |
| 418 |
structural pattern matching cases. |
| 419 |
|
| 420 |
Closes #5288 (`#5288 <https://github.com/pylint-dev/pylint/issues/5288>`_) |
| 421 |
|
| 422 |
- Fix false positive for ``used-before-assignment`` when |
| 423 |
``typing.TYPE_CHECKING`` is used with if/elif/else blocks. |
| 424 |
|
| 425 |
Closes #7574 (`#7574 <https://github.com/pylint-dev/pylint/issues/7574>`_) |
| 426 |
|
| 427 |
- Fix false positive for :ref:`isinstance-second-argument-not-valid-type` with union |
| 428 |
types. |
| 429 |
|
| 430 |
Closes #8205 (`#8205 <https://github.com/pylint-dev/pylint/issues/8205>`_) |
| 431 |
|
| 432 |
- Fix false positive for ``used-before-assignment`` for named expressions |
| 433 |
appearing after the first element in a list, tuple, or set. |
| 434 |
|
| 435 |
Closes #8252 (`#8252 <https://github.com/pylint-dev/pylint/issues/8252>`_) |
| 436 |
|
| 437 |
- Fix false positive for ``wrong-spelling-in-comment`` with class names in a |
| 438 |
python 2 type comment. |
| 439 |
|
| 440 |
Closes #8370 (`#8370 <https://github.com/pylint-dev/pylint/issues/8370>`_) |
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
False Negatives Fixed |
| 445 |
--------------------- |
| 446 |
|
| 447 |
- Fix a false negative for :ref:`missing-parentheses-for-call-in-test`' when |
| 448 |
inference |
| 449 |
failed for the internal of the call as we did not need that information to |
| 450 |
raise |
| 451 |
correctly. |
| 452 |
|
| 453 |
Refs #8185 (`#8185 <https://github.com/pylint-dev/pylint/issues/8185>`_) |
| 454 |
|
| 455 |
- Fix false negative for inconsistent-returns with while-loops. |
| 456 |
|
| 457 |
Closes #8280 (`#8280 <https://github.com/pylint-dev/pylint/issues/8280>`_) |
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
Other Bug Fixes |
| 462 |
--------------- |
| 463 |
|
| 464 |
- Fix ``used-before-assignment`` false positive when the walrus operator |
| 465 |
is used with a ternary operator in dictionary key/value initialization. |
| 466 |
|
| 467 |
Closes #8125 (`#8125 <https://github.com/pylint-dev/pylint/issues/8125>`_) |
| 468 |
|
| 469 |
- Fix ``no-name-in-module`` false positive raised when a package defines a |
| 470 |
variable with the |
| 471 |
same name as one of its submodules. |
| 472 |
|
| 473 |
Closes #8148 (`#8148 <https://github.com/pylint-dev/pylint/issues/8148>`_) |
| 474 |
|
| 475 |
- Fix a crash happening for python interpreter < 3.9 following a failed typing |
| 476 |
update. |
| 477 |
|
| 478 |
Closes #8161 (`#8161 <https://github.com/pylint-dev/pylint/issues/8161>`_) |
| 479 |
|
| 480 |
- Fix ``nested-min-max`` suggestion message to indicate it's possible to splat |
| 481 |
iterable objects. |
| 482 |
|
| 483 |
Closes #8168 (`#8168 <https://github.com/pylint-dev/pylint/issues/8168>`_) |
| 484 |
|
| 485 |
- Fix a crash happening when a class attribute was negated in the start |
| 486 |
argument of an enumerate. |
| 487 |
|
| 488 |
Closes #8207 (`#8207 <https://github.com/pylint-dev/pylint/issues/8207>`_) |
| 489 |
|
| 490 |
- Prevent emitting ``invalid-name`` for the line on which a ``global`` |
| 491 |
statement is declared. |
| 492 |
|
| 493 |
Closes #8307 (`#8307 <https://github.com/pylint-dev/pylint/issues/8307>`_) |
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
Other Changes |
| 498 |
------------- |
| 499 |
|
| 500 |
- Update explanation for ``global-variable-not-assigned`` and add confidence. |
| 501 |
|
| 502 |
Closes #5073 (`#5073 <https://github.com/pylint-dev/pylint/issues/5073>`_) |
| 503 |
|
| 504 |
- The governance model and the path to become a maintainer have been documented |
| 505 |
as |
| 506 |
part of our effort to guarantee that the software supply chain in which |
| 507 |
pylint is |
| 508 |
included is secure. |
| 509 |
|
| 510 |
Refs #8329 (`#8329 <https://github.com/pylint-dev/pylint/issues/8329>`_) |