From ca978686a0a469f8f6f3a30fcc0053959e8d9ecf Mon Sep 17 00:00:00 2001 From: Andris Raugulis Date: Thu, 20 Oct 2016 15:39:47 +0300 Subject: [PATCH 1/4] Fix Pylint collector to get reported messages from newer Pylint versions. Fixes #183 and #188. --- prospector/tools/pylint/collector.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/prospector/tools/pylint/collector.py b/prospector/tools/pylint/collector.py index 65c0bd41..5da34472 100644 --- a/prospector/tools/pylint/collector.py +++ b/prospector/tools/pylint/collector.py @@ -13,6 +13,10 @@ def __init__(self, message_store): self._message_store = message_store self._messages = [] + def handle_message(self, msg): + location = (msg.abspath, msg.module, msg.obj, msg.line, msg.column) + self.add_message(msg.msg_id, location, msg.msg) + def add_message(self, msg_id, location, msg): # (* magic is acceptable here) loc = Location(*location) From 04414edc01169acbd98a70596a4efa6a962aa8ba Mon Sep 17 00:00:00 2001 From: carlio Date: Tue, 2 May 2017 09:45:21 +0800 Subject: [PATCH 2/4] astroid 1.5.2 dies to due a maximum recursion limit which, after binary chopping, seems to be due to the recursion in _load_profile. By creating a copy of the inherits list, the astroid recursion goes away, so this must be some follow-by-ref vs follow-by-val difference. --- prospector/profiles/profile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prospector/profiles/profile.py b/prospector/profiles/profile.py index b7f92037..82d58acc 100644 --- a/prospector/profiles/profile.py +++ b/prospector/profiles/profile.py @@ -356,4 +356,4 @@ def _load_profile(name_or_path, profile_path, shorthands_found=None, inherit_order += new_il shorthands_found |= new_sh - return contents_dict, inherit_order, shorthands_found + return contents_dict, list(inherit_order), shorthands_found From 68635fc84f051e35a339aae985267f679ca88a7e Mon Sep 17 00:00:00 2001 From: carlio Date: Tue, 2 May 2017 10:00:21 +0800 Subject: [PATCH 3/4] Adding commend about astroid tweak --- prospector/profiles/profile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prospector/profiles/profile.py b/prospector/profiles/profile.py index 82d58acc..e52f8da7 100644 --- a/prospector/profiles/profile.py +++ b/prospector/profiles/profile.py @@ -356,4 +356,7 @@ def _load_profile(name_or_path, profile_path, shorthands_found=None, inherit_order += new_il shorthands_found |= new_sh + # note: a new list is returned here rather than simply using inherit_order to give astroid a + # clue about the type of the returned object, as otherwise it can recurse infinitely and crash, + # this meaning that prospector does not run on prospector cleanly! return contents_dict, list(inherit_order), shorthands_found From a9c008e586d026f774263e2c2316f744326cf43e Mon Sep 17 00:00:00 2001 From: carlio Date: Tue, 2 May 2017 10:04:34 +0800 Subject: [PATCH 4/4] [fixes #202] Sneakily avoiding .tox directories to avoid checking too many files --- prospector/finder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prospector/finder.py b/prospector/finder.py index dcd7e65b..6b140a9e 100644 --- a/prospector/finder.py +++ b/prospector/finder.py @@ -160,7 +160,7 @@ def _find_paths(ignore, curpath, rootpath): if os.path.isdir(fullpath): # is it probably a virtualenvironment? - if is_virtualenv(fullpath): + if is_virtualenv(fullpath) or '.tox' in fullpath: continue # this is a directory