What's New in Pylint 4.0

:Release:4.0 :Date: TBA

Summary -- Release highlights

What's new in Pylint 4.0.0?

Release date: TBA

Breaking Changes

  • Commented out code blocks such as #    bar() # TODO: remove dead code will no longer emit fixme.

    Refs #9255 (#9255)

  • pyreverse Run was changed to no longer call sys.exit() in its __init__. You should now call Run(args).run() which will return the exit code instead. Having a class that always raised a SystemExit exception was considered a bug.

    Normal usage of pyreverse through the CLI will not be affected by this change.

    Refs #9689 (#9689)

  • The async.py checker module has been renamed to async_checker.py since async is a Python keyword and cannot be imported directly. This allows for better testing and extensibility of the async checker functionality.

    Refs #10071 (#10071)

New Features

  • The fixme check can now search through docstrings as well as comments, by using check-fixme-in-docstring = true in the [tool.pylint.miscellaneous] section.

    Closes #9255 (#9255)

  • Add --max-depth option to pyreverse to control diagram complexity. A depth of 0 shows only top-level packages, 1 shows one level of subpackages, etc. This helps manage visualization of large codebases by limiting the depth of displayed packages and classes.

    Refs #10077 (#10077)

False Positives Fixed

  • Fix a false positive for used-before-assignment when a variable defined under an if and via a named expression (walrus operator) is used later when guarded under the same if test.

    Closes #10061 (#10061)

  • Fix a false positive for invalid-getnewargs-ex-returned when the tuple or dict has been assigned to a name.

    Closes #10208 (#10208)

  • Remove getopt and optparse from the list of deprecated modules.

    Closes #10211 (#10211)

False Negatives Fixed

  • Fix false negative for used-before-assignment when a TYPE_CHECKING import is used as a type annotation prior to erroneous usage.

    Refs #8893 (#8893)

  • Fix false negative for used-before-assignment when a function is defined inside a TYPE_CHECKING guard block and used later.

    Closes #10028 (#10028)

Other Bug Fixes

  • Fixes "skipped files" count calculation; the previous method was displaying an arbitrary number.

    Closes #10073 (#10073)

  • Fixes a crash that occurred when pylint was run in a container on a host with cgroupsv2 and restrictions on CPU usage.

    Closes #10103 (#10103)

  • Relaxed the requirements for isort so pylint can benefit from isort 6.

    Closes #10203 (#10203)