Skip to content

Commit 252e461

Browse files
committed
Fixed #334
The INFO message will still be printed if `--verbose` option is set, but these will no lonfer counted as errors. Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 88dc4eb commit 252e461

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/attributecode/cmd.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,21 +378,24 @@ def check(location, verbose):
378378

379379
msg_format = '%(sever)s: %(message)s'
380380
print_errors = []
381+
number_of_errors = 0
381382
for severity, message in errors:
382383
sever = severities[severity]
384+
# Only problematic_errors should be counted.
385+
# Others such as INFO should not be counted as error.
386+
if sever in problematic_errors:
387+
number_of_errors = number_of_errors + 1
383388
if verbose:
384389
print_errors.append(msg_format % locals())
385390
elif sever in problematic_errors:
386391
print_errors.append(msg_format % locals())
387392

388-
number_of_errors = len(print_errors)
389-
390393
for err in print_errors:
391394
print(err)
392395

393396
if print_errors:
394397
click.echo('Found {} errors.'.format(number_of_errors))
395-
# FIXME: not sure this is the right way to exit with a retrun code
398+
# FIXME: not sure this is the right way to exit with a return code
396399
sys.exit(1)
397400
else:
398401
click.echo('No error found.')

0 commit comments

Comments
 (0)