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

[BUG] pylint w0614 combine exception #477

Closed
stdweird opened this issue Jan 14, 2022 · 3 comments
Closed

[BUG] pylint w0614 combine exception #477

stdweird opened this issue Jan 14, 2022 · 3 comments
Labels

Comments

@stdweird
Copy link
Contributor

Describe the bug
Pylint now has new ways of merging wildcard import errors since pylint-dev/pylint#5110 was merged. Now the regex in https://github.com/PyCQA/prospector/blob/master/prospector/tools/pylint/__init__.py#L235 has no match, and raises an exception

    prospector.execute()
  File "/some/path/workspace/.eggs/prospector-1.5.3.1-py3.6.egg/prospector/run.py", line 69, in execute
    messages += tool.run(found_files)
  File "/some/path/workspace/.eggs/prospector-1.5.3.1-py3.6.egg/prospector/tools/pylint/__init__.py", line 262, in run
    return self.combine(messages)
  File "/some/path/workspace/.eggs/prospector-1.5.3.1-py3.6.egg/prospector/tools/pylint/__init__.py", line 254, in combine
    combined = self._combine_w0614(messages)
  File "/some/path/workspace/.eggs/prospector-1.5.3.1-py3.6.egg/prospector/tools/pylint/__init__.py", line 235, in _combine_w0614
    names.append(_UNUSED_WILDCARD_IMPORT_RE.match(msg.message).group(1))
AttributeError: 'NoneType' object has no attribute 'group'

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Call prospector the following way '....'
  3. See error

Expected behavior
non-matching group exception is handled.
ideally detecting this is an already merged message?

Environment (please complete the following information):

  • OS: [e.g. macOS] linux
  • Tool [e.g. pylint] pylint
  • Prospector version [e.g. 1.1.7] 1.5.3.1
  • Python version [e.g. 3.6.8] 3.6.9

Additional context

@stdweird stdweird changed the title [BUG] [BUG] pylint w0614 combine exception Jan 14, 2022
@thburghout
Copy link

Confirmed. The regex should be

_UNUSED_WILDCARD_IMPORT_RE = re.compile(r"^Unused import\(s\) (.*) from wildcard import")

@Pierre-Sassoulas
Copy link
Collaborator

@thburghout I would merge a fix for this if you want to open a merge request :)

carlio added a commit that referenced this issue Feb 26, 2022
…int has different message format than old, and so to keep both working, update the regexp to handle both
@carlio
Copy link
Member

carlio commented Feb 26, 2022

I've added this fix onto the master branch, thanks for the investigation and regex :-) I'll go out with the 1.7.1 release

@carlio carlio closed this as completed Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants