Skip to content

Commit

Permalink
Merge pull request #390 from PyCQA/bugfix/389-vulture-compatability
Browse files Browse the repository at this point in the history
Updating Vulture API usage for newer versions of Vulture
  • Loading branch information
chocoelho authored Aug 22, 2020
2 parents 3cffb79 + 4a2b4c7 commit aa0cd3f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions prospector/tools/vulture/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class ProspectorVulture(Vulture):
def __init__(self, found_files):
Vulture.__init__(self, exclude=None, verbose=False)
Vulture.__init__(self, verbose=False)
self._files = found_files
self._internal_messages = []

Expand Down Expand Up @@ -51,7 +51,11 @@ def get_messages(self):
filename = item.file
except AttributeError:
filename = item.filename
loc = Location(filename, None, None, item.lineno, -1)
if hasattr(item, 'lineno'):
lineno = item.lineno # for older versions of vulture
else:
lineno = item.first_lineno
loc = Location(filename, None, None, lineno, -1)
message_text = template % item
message = Message("vulture", code, loc, message_text)
vulture_messages.append(message)
Expand Down

0 comments on commit aa0cd3f

Please sign in to comment.