WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 71ee34c

Browse files
committed
Process whole output
This commit modifies process_output to process all the detected problems instead of just the first one. Fixes #2882
1 parent fd5a5a7 commit 71ee34c

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

bears/python/PycodestyleBear.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,22 @@ def create_arguments(
7474
def process_output(self, output, filename, file):
7575
if not output: # backwards compatible no results
7676
return
77-
result = re.match(OUTPUT_REGEX, output)
77+
result = re.findall(OUTPUT_REGEX, output)
7878
if not result: # backwards compatible no results
7979
self.warn('{}: Unexpected output {}'.format(filename, output))
8080
return
81-
line, column, message, rule = result.groups()
82-
if rule == 'E501':
83-
aspect = LineLength('py')
84-
else:
85-
aspect = None
86-
yield Result.from_values(
87-
origin='{} ({})'.format(self.name, rule),
88-
message=message,
89-
file=filename,
90-
line=int(line),
91-
column=int(column),
92-
aspect=aspect,
93-
)
81+
82+
for line, column, message, rule in result:
83+
if rule == 'E501':
84+
aspect = LineLength('py')
85+
else:
86+
aspect = None
87+
88+
yield Result.from_values(
89+
origin='{} ({})'.format(self.name, rule),
90+
message=message,
91+
file=filename,
92+
line=int(line),
93+
column=int(column),
94+
aspect=aspect,
95+
)

0 commit comments

Comments
 (0)