Skip to content

Warning with underscore _ breaks pragma parsing #3604

Closed
@VladimirSlavik

Description

@VladimirSlavik

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)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions