mirror of https://github.com/ARMmbed/mbed-os.git
scancode: add logger and parse it to get count
parent
adaa2b6a0a
commit
1b4ad98787
|
|
@ -82,7 +82,8 @@ matrix:
|
|||
echo "License check OK";
|
||||
else
|
||||
echo "License check failed, please review license issues found";
|
||||
STATUSM="Needs review, ${retval} license issues found";
|
||||
COUNT=$(cat scancode-evaluate.log | grep File: | wc -l)
|
||||
STATUSM="Needs review, ${COUNT} license issues found";
|
||||
set_status "success" "$STATUSM";
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ import re
|
|||
|
||||
userlog = logging.getLogger("scancode-evaluate")
|
||||
userlog.setLevel(logging.INFO)
|
||||
logfile = os.path.join(os.getcwd(), 'scancode-evaluate.log')
|
||||
log_file_handler = logging.FileHandler(logfile, mode='w')
|
||||
userlog.addHandler(log_file_handler)
|
||||
|
||||
MISSING_LICENSE_TEXT = "Missing license header"
|
||||
MISSING_PERMISIVE_LICENSE_TEXT = "Non-permissive license"
|
||||
|
|
@ -120,7 +123,11 @@ if __name__ == "__main__":
|
|||
|
||||
args = parse_args()
|
||||
if args.file and os.path.isfile(args.file):
|
||||
sys.exit(license_check(args.directory_name, args.file))
|
||||
count = license_check(args.directory_name, args.file)
|
||||
if count == 0:
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(-1)
|
||||
else:
|
||||
userlog.warning("Could not find the scancode json file")
|
||||
sys.exit(-1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue