github pylint-dev/pylint v2.15.0

latest releases: v3.3.1, v3.3.0, v3.2.7...
2 years ago

In pylint 2.15.0, we added a new check missing-timeout to warn of default timeout values that could cause a program to be hanging indefinitely.

We improved pylint's handling of namespace packages. More packages should be linted without resorting to using the --recursive=y option.

We still welcome any community effort to help review, integrate, and add good/bad examples to the doc for #5953. This should be doable without any pylint or astroid knowledge, so this is the perfect entrypoint if you want to contribute to pylint or open source without any experience with our code!

Internally, we changed the way we generate the release notes, thanks to DudeNr33. There will be no more conflict resolution to do in the changelog, and every contributor rejoice.

Marc Byrne became a maintainer, welcome to the team !

New Checks

  • Added new checker missing-timeout to warn of default timeout values that could cause
    a program to be hanging indefinitely.

    Refs #6780

False Positives Fixed

  • Don't report super-init-not-called for abstract __init__ methods.

    Closes #3975

  • Don't report unsupported-binary-operation on Python <= 3.9 when using the | operator
    with types, if one has a metaclass that overloads __or__ or __ror__ as appropriate.

    Closes #4951

  • Don't report no-value-for-parameter for dataclasses fields annotated with KW_ONLY.

    Closes #5767

  • Fixed inference of Enums when they are imported under an alias.

    Closes #5776

  • Prevent false positives when accessing PurePath.parents by index (not slice) on Python 3.10+.

    Closes #5832

  • unnecessary-list-index-lookup is now more conservative to avoid potential false positives.

    Closes #6896

  • Fix double emitting trailing-whitespace for multi-line docstrings.

    Closes #6936

  • import-error now correctly checks for contextlib.suppress guards on import statements.

    Closes #7270

  • Fix false positive for no-self-argument/no-method-argument when a staticmethod is applied to a function but uses a different name.

    Closes #7300

  • Fix undefined-loop-variable with break and continue statements in else blocks.

    Refs #7311

False Negatives Fixed

  • Emit used-before-assignment when relying on a name that is reimported later in a function.

    Closes #4624

  • Emit used-before-assignment for self-referencing named expressions (:=) lacking
    prior assignments.

    Closes #5653

  • Emit used-before-assignment for self-referencing assignments under if conditions.

    Closes #6643

  • Emit modified-iterating-list and analogous messages for dicts and sets when iterating
    literals, or when using the del keyword.

    Closes #6648

  • Emit used-before-assignment when calling nested functions before assignment.

    Closes #6812

  • Emit nonlocal-without-binding when a nonlocal name has been assigned at a later point in the same scope.

    Closes #6883

  • Emit using-constant-test when testing the truth value of a variable or call result
    holding a generator.

    Closes #6909

  • Rename unhashable-dict-key to unhashable-member and emit when creating sets and dicts,
    not just when accessing dicts.

    Closes #7034, Closes #7055

Other Bug Fixes

  • Fix a failure to lint packages with __init__.py contained in directories lacking __init__.py.

    Closes #1667

  • Fixed a syntax-error crash that was not handled properly when the declared encoding of a file
    was utf-9.

    Closes #3860

  • Fix a crash in the not-callable check when there is ambiguity whether an instance is being incorrectly provided to __new__().

    Closes #7109

  • Fix crash when regex option raises a re.error exception.

    Closes #7202

  • Fix undefined-loop-variable from walrus in comprehension test.

    Closes #7222

  • Check for <cwd> before removing first item from sys.path in modify_sys_path.

    Closes #7231

  • Fix sys.path pollution in parallel mode.

    Closes #7246

  • Prevent useless-parent-delegation for delegating to a builtin
    written in C (e.g. Exception.__init__) with non-self arguments.

    Closes #7319

Other Changes

  • bad-exception-context has been renamed to bad-exception-cause as it is about the cause and not the context.

    Closes #3694

  • The message for literal-comparison is now more explicit about the problem and the
    solution.

    Closes #5237

  • useless-super-delegation has been renamed to useless-parent-delegation in order to be more generic.

    Closes #6953

  • Pylint now uses towncrier for changelog generation.

    Refs #6974

  • Update astroid to 2.12.

    Refs #7153

  • Fix crash when a type-annotated __slots__ with no value is declared.

    Closes #7280

Internal Changes

  • Fixed an issue where it was impossible to update functional tests output when the existing
    output was impossible to parse. Instead of raising an error we raise a warning message and
    let the functional test fail with a default value.

    Refs #6891

  • pylint.testutils.primer is now a private API.

    Refs #6905

  • We changed the way we handle the changelog internally by using towncrier.
    If you're a contributor you won't have to fix merge conflicts in the
    changelog anymore.

    Closes #6974

  • Pylint is now using Scorecards to implement security recommendations from the
    OpenSSF <https://openssf.org/>_. This is done in order to secure our supply chains using a combination
    of automated tooling and best practices, most of which were already implemented before.

    Refs #7267

Don't miss a new pylint release

NewReleases is sending notifications on new releases.