mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			travis: license check does not fail but report issues
Master branch contains lot of missing SPDX identifiers, we will clean them up but this will take some time. In the meantime, we should not increase the license missing files. Each PR will report if there is no license issue or positive number reported as Github status. Travis won't fail if there are issues. This will highlight the issues that anyone can fix. As soon as master is clean, we can fix set_status and revert part of this commit.pull/12437/head
							parent
							
								
									37a7ff0443
								
							
						
					
					
						commit
						adaa2b6a0a
					
				
							
								
								
									
										13
									
								
								.travis.yml
								
								
								
								
							
							
						
						
									
										13
									
								
								.travis.yml
								
								
								
								
							| 
						 | 
				
			
			@ -73,7 +73,20 @@ matrix:
 | 
			
		|||
              | ( grep -v '^tools/test/toolchains/api_test.py') \
 | 
			
		||||
              | while read file; do cp --parents "${file}" SCANCODE; done
 | 
			
		||||
        - scancode -l --json-pp scancode.json SCANCODE
 | 
			
		||||
        - python ./tools/test/travis-ci/scancode-evaluate.py -f scancode.json || true
 | 
			
		||||
      after_success:
 | 
			
		||||
        - python ./tools/test/travis-ci/scancode-evaluate.py -f scancode.json
 | 
			
		||||
        - retval=$?
 | 
			
		||||
        - |
 | 
			
		||||
          if [ $retval == 0 ]; then
 | 
			
		||||
              echo "License check OK";
 | 
			
		||||
            else
 | 
			
		||||
              echo "License check failed, please review license issues found";
 | 
			
		||||
              STATUSM="Needs review, ${retval} license issues found";
 | 
			
		||||
              set_status "success" "$STATUSM";
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    - <<: *basic-vm
 | 
			
		||||
      name: "include check"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,9 @@ def license_check(directory_name, file):
 | 
			
		|||
    file - scancode json output file (output from scancode --license --json-pp)
 | 
			
		||||
 | 
			
		||||
    Returns:    
 | 
			
		||||
    0 if success, -1 if any error in file licenses found
 | 
			
		||||
    0 if nothing found
 | 
			
		||||
    >0 - count how many license isses found
 | 
			
		||||
    -1 if any error in file licenses found
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    offenders = []
 | 
			
		||||
| 
						 | 
				
			
			@ -103,9 +105,7 @@ def license_check(directory_name, file):
 | 
			
		|||
        userlog.warning("Found files with missing license details, please review and fix")
 | 
			
		||||
        for offender in offenders:
 | 
			
		||||
            userlog.warning("File: " + offender['file']['path'][len(directory_name):] + " " + "reason: " + offender['reason'])
 | 
			
		||||
        return -1
 | 
			
		||||
    else:
 | 
			
		||||
        return 0
 | 
			
		||||
    return len(offenders)
 | 
			
		||||
 | 
			
		||||
def parse_args():
 | 
			
		||||
    parser = argparse.ArgumentParser(
 | 
			
		||||
| 
						 | 
				
			
			@ -119,7 +119,6 @@ def parse_args():
 | 
			
		|||
if __name__ == "__main__":
 | 
			
		||||
 | 
			
		||||
    args = parse_args()
 | 
			
		||||
 | 
			
		||||
    if args.file and os.path.isfile(args.file):
 | 
			
		||||
        sys.exit(license_check(args.directory_name, args.file))
 | 
			
		||||
    else:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue