Skip to content

Commit

Permalink
Implement support for vulture 0.9 and up.
Browse files Browse the repository at this point in the history
  • Loading branch information
arthepsy committed Oct 20, 2016
1 parent a5606a9 commit 3f4d873
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions prospector/tools/vulture/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def scavenge(self, _=None):
))
continue
self.file = module
self.scan(module_string)
self.filename = module
try:
self.scan(module_string, filename=module)
except TypeError:
self.scan(module_string)

def get_messages(self):
all_items = (
Expand All @@ -40,7 +44,11 @@ def get_messages(self):
vulture_messages = []
for code, template, items in all_items:
for item in items:
loc = Location(item.file, None, None, item.lineno, -1)
try:
filename = item.file
except AttributeError:
filename = item.filename
loc = Location(filename, None, None, item.lineno, -1)
message_text = template % item
message = Message('vulture', code, loc, message_text)
vulture_messages.append(message)
Expand Down

0 comments on commit 3f4d873

Please sign in to comment.