From 71ee34c7d22d63aad693f20a76bce318d8a36f8c Mon Sep 17 00:00:00 2001 From: areebbeigh Date: Tue, 9 Apr 2019 12:03:40 +0530 Subject: [PATCH] Process whole output This commit modifies process_output to process all the detected problems instead of just the first one. Fixes https://github.com/coala/coala-bears/issues/2882 --- bears/python/PycodestyleBear.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/bears/python/PycodestyleBear.py b/bears/python/PycodestyleBear.py index 405f369677..e5b4243718 100644 --- a/bears/python/PycodestyleBear.py +++ b/bears/python/PycodestyleBear.py @@ -74,20 +74,22 @@ def create_arguments( def process_output(self, output, filename, file): if not output: # backwards compatible no results return - result = re.match(OUTPUT_REGEX, output) + result = re.findall(OUTPUT_REGEX, output) if not result: # backwards compatible no results self.warn('{}: Unexpected output {}'.format(filename, output)) return - line, column, message, rule = result.groups() - if rule == 'E501': - aspect = LineLength('py') - else: - aspect = None - yield Result.from_values( - origin='{} ({})'.format(self.name, rule), - message=message, - file=filename, - line=int(line), - column=int(column), - aspect=aspect, - ) + + for line, column, message, rule in result: + if rule == 'E501': + aspect = LineLength('py') + else: + aspect = None + + yield Result.from_values( + origin='{} ({})'.format(self.name, rule), + message=message, + file=filename, + line=int(line), + column=int(column), + aspect=aspect, + )