From 4a2b4c7b9fbf9e23669d4a4b6cf05237cb82b61b Mon Sep 17 00:00:00 2001 From: Carl Date: Wed, 8 Jul 2020 16:56:07 +0200 Subject: [PATCH] [refs #389] Updating Vulture API usage for newer versions of Vulture (but keeping backwards compatability just in case) --- prospector/tools/vulture/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/prospector/tools/vulture/__init__.py b/prospector/tools/vulture/__init__.py index 5702e1ee..a6b92e52 100644 --- a/prospector/tools/vulture/__init__.py +++ b/prospector/tools/vulture/__init__.py @@ -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 = [] @@ -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)