From db499390944a7ebd033dda1da2cce40dcae6b7cf Mon Sep 17 00:00:00 2001 From: Milosz Wasilewski Date: Mon, 7 Nov 2016 19:43:51 +0000 Subject: validate: fix validation return code Only return code for last checked file was returned. Now the highest return code is returned for the list of files Change-Id: I795e891b995eec121187778e4213f96e08d171b3 Signed-off-by: Milosz Wasilewski --- validate.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'validate.py') diff --git a/validate.py b/validate.py index 30e7479..1e981b4 100755 --- a/validate.py +++ b/validate.py @@ -156,8 +156,9 @@ def validate_file(args, path): exitcode = pep8_check(path, args.pep8_ignore) elif path.endswith(".php"): exitcode = validate_php(path) - else: - # try shellcheck by default + elif path.endswith(".sh") or \ + path.endswith("sh-test-lib") or \ + path.endswith("android-test-lib"): exitcode = validate_shell(path, args.shellcheck_ignore) return exitcode @@ -166,14 +167,18 @@ def run_unit_tests(args, filelist=None): exitcode = 0 if filelist is not None: for filename in filelist: - exitcode = validate_file(args, filename) + tmp_exitcode = validate_file(args, filename) + if tmp_exitcode != 0: + exitcode = 1 else: for root, dirs, files in os.walk('.'): if not root.startswith("./.git"): for name in files: - exitcode = validate_file( + tmp_exitcode = validate_file( args, root + "/" + name) + if tmp_exitcode != 0: + exitcode = 1 return exitcode -- cgit v1.2.3