Skip to content
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

Warning with underscore _ breaks pragma parsing #3604

Closed
VladimirSlavik opened this issue May 7, 2020 · 4 comments
Closed

Warning with underscore _ breaks pragma parsing #3604

VladimirSlavik opened this issue May 7, 2020 · 4 comments
Milestone

Comments

@VladimirSlavik
Copy link

VladimirSlavik commented May 7, 2020

For a particular warning in disable pragma, pylint fails to parse the identifier string. The warning comes from a plugin (pocketlint) and is called found-_-in-module-class (note underscore). Instead of disabling, E0012 is emitted and the disable does not happen (obviously). Once the disable is changed to use the numeric identifier W9902, the issue goes away.

This regression appeared after updating pylint from 2.4.4. to 2.5.0.

Steps to reproduce

  1. pip3 install --user pocketlint
  2. pip3 install --user pylint==2.5.0
  3. git clone [email protected]:rhinstaller/anaconda.git
  4. cd anaconda
  5. git checkout anaconda-33.13-1
  6. PYTHONPATH=`pwd` python3 -m pylint --rcfile tests/pylint/pylintrc anaconda.py
  7. Replace found-_-in-module-class in the indicated line with W9902
  8. PYTHONPATH=`pwd` python3 -m pylint --rcfile tests/pylint/pylintrc anaconda.py

Current behavior

Buggy behavior:

E0012(bad-option-value):anaconda.py:379,0: : Bad option value 'found-'
E0012(bad-option-value):anaconda.py:379,0: : Bad option value '-in-module-class'
W9902(found-_-in-module-class):anaconda.py:381,57: : Found _ call at module/class level
W9902(found-_-in-module-class):anaconda.py:382,35: : Found _ call at module/class level

After replacing:
(no output)

See relevant files:

Expected behavior

No output

pylint --version output

$ python3 -m pylint --version
pylint 2.5.0
astroid 2.4.1
Python 3.7.7 (default, Mar 13 2020, 21:39:43) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
@VladimirSlavik
Copy link
Author

I have edited the report to pin the version of code for the "broken" one - obviously the line will be changed to the variant that does not trigger the bug (for now? forever?).

@jkonecny12
Copy link

Another reproducer which does not depend on Anaconda project.

pylint-reproducer.py

# pylint: disable=raw_input-builtin
raw_input()

Then run

python3 -m pylint --enable=W1609 ./pylint-reproducer.py

You will see plenty of errors but also the E0012.

@PCManticore
Copy link
Contributor

2.5.3 is going to permit this again once released.

@VladimirSlavik
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants