Skip to content

Commit

Permalink
[refs #389] Updating Vulture API usage for newer versions of Vulture …
Browse files Browse the repository at this point in the history
…(but keeping backwards compatability just in case)
  • Loading branch information
carlio committed Jul 8, 2020
1 parent 4cf007c commit 4a2b4c7
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 4a2b4c7

Please sign in to comment.