Skip to content

Commit

Permalink
Merge pull request #194 from arthepsy/feature-vulture-9-and-plus
Browse files Browse the repository at this point in the history
feature: add support for vulture 0.9 and up.
  • Loading branch information
carlio authored May 2, 2017
2 parents 394859d + 3f4d873 commit a5befc0
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 a5befc0

Please sign in to comment.