Skip to content

Commit 9455b14

Browse files
committed
Return exit code(1) in case of errors
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 3406714 commit 9455b14

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/attributecode/cmd.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import click
2626
import unicodecsv
27+
import sys
2728

2829
import attributecode
2930
from attributecode import CRITICAL
@@ -225,10 +226,16 @@ def check(location):
225226
errors, abouts = attributecode.model.collect_inventory(location)
226227

227228
msg_format = '%(sever)s: %(message)s'
229+
print_errors = []
228230
for severity, message in errors:
229231
sever = severities[severity]
230232
if sever in important_errors:
231-
print(msg_format % locals())
233+
print_errors.append((msg_format % locals()))
234+
235+
if print_errors:
236+
for err in print_errors:
237+
print(err)
238+
sys.exit(1)
232239

233240

234241
def log_errors(errors, quiet, base_dir=False):

0 commit comments

Comments
 (0)