Skip to content

pylint: disable=all comment is applied to the whole file #8725

Open
@ruro

Description

@ruro

Bug description

Consider the following example:

"""Module level docstring"""

def enable_here():
    """This function should have a warning."""
    x = "bad name"
    return x


def disable_here():
    """No pylint warnings in this function, please."""
    # pylint: disable=all
    x = "bad name"
    return x

For some reason, the disable=all comment disables the warnings for the whole file, instead of only for the current block/current line/next line/etc. Compare this with the exact same file, but with disable=invalid-name instead of disable=all.

Configuration

None

Command used

pylint test.py

Pylint output

(no output)

Expected output

************* Module test
test.py:5:4: C0103: Variable name "x" doesn't conform to snake_case naming style (invalid-name)

Pylint version

pylint 2.17.4
astroid 2.15.5
Python 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201]

OS / Environment

Manjaro (Arch Linux)

Additional dependencies

astroid==2.15.5
dill==0.3.6
isort==5.12.0
lazy-object-proxy==1.9.0
mccabe==0.7.0
platformdirs==3.5.1
pylint==2.17.4
tomli==2.0.1
tomlkit==0.11.8
typing_extensions==4.6.2
wrapt==1.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions