Skip to content

pylint ignoring the disable comment in some cases #4799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RoniGurvich opened this issue Aug 4, 2021 · 1 comment
Closed

pylint ignoring the disable comment in some cases #4799

RoniGurvich opened this issue Aug 4, 2021 · 1 comment
Labels
Bug 🪲 Duplicate 🐫 Duplicate of an already existing issue

Comments

@RoniGurvich
Copy link

Bug description

it looks like some disable messages are ignored


a = None
condition = True
if condition:
    # pylint: disable=unsupported-assignment-operation
    a['b'] = 'c'  # not raising error
    # pylint: enable=unsupported-assignment-operation
else:
    pass

if not condition:
    pass
else:
    # pylint: disable=unsupported-assignment-operation
    a['b'] = 'c'  # raising error
    # pylint: enable=unsupported-assignment-operation

Configuration

No response

Command used

pylint disable_issue.py

Pylint output

************* Module disable_issue
disable_issue.py:14:4: E1137: 'a' does not support item assignment (unsupported-assignment-operation)

-----------------------------------
Your code has been rated at 3.75/10

Expected behavior

no issues found because it is suppressed

Pylint version

pylint 2.9.6
astroid 2.6.6
Python 3.9.6 (default, Jun 29 2021, 05:25:02)
[Clang 12.0.5 (clang-1205.0.22.9)]

OS / Environment

macOS

Additional dependencies

No response

@RoniGurvich RoniGurvich added Bug 🪲 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Aug 4, 2021
@Pierre-Sassoulas
Copy link
Member

Duplicate of #872

@Pierre-Sassoulas Pierre-Sassoulas marked this as a duplicate of #872 Aug 4, 2021
@Pierre-Sassoulas Pierre-Sassoulas added Duplicate 🐫 Duplicate of an already existing issue and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

2 participants