@@ -89,7 +89,8 @@ def license_check(scancode_output_path):
8989 ReturnCode.ERROR.value if any error in file licenses found
9090 """
9191
92- offenders = []
92+ license_offenders = []
93+ spdx_offenders = []
9394 try :
9495 with open (scancode_output_path , 'r' ) as read_file :
9596 scancode_output_data = json .load (read_file )
@@ -107,13 +108,13 @@ def license_check(scancode_output_path):
107108
108109 if not scancode_output_data_file ['licenses' ]:
109110 scancode_output_data_file ['fail_reason' ] = MISSING_LICENSE_TEXT
110- offenders .append (scancode_output_data_file )
111+ license_offenders .append (scancode_output_data_file )
111112 # check the next file in the scancode output
112113 continue
113114
114115 if not has_permissive_text_in_scancode_output (scancode_output_data_file ['licenses' ]):
115116 scancode_output_data_file ['fail_reason' ] = MISSING_PERMISSIVE_LICENSE_TEXT
116- offenders .append (scancode_output_data_file )
117+ license_offenders .append (scancode_output_data_file )
117118
118119 if not has_spdx_text_in_scancode_output (scancode_output_data_file ['licenses' ]):
119120 # Scancode does not recognize license notice in Python file headers.
@@ -131,13 +132,17 @@ def license_check(scancode_output_path):
131132
132133 if not has_spdx_text_in_analysed_file (scanned_file_content ):
133134 scancode_output_data_file ['fail_reason' ] = MISSING_SPDX_TEXT
134- offenders .append (scancode_output_data_file )
135+ spdx_offenders .append (scancode_output_data_file )
135136
136- if offenders :
137+ if license_offenders :
137138 userlog .warning ("Found files with missing license details, please review and fix" )
138- for offender in offenders :
139+ for offender in license_offenders :
139140 userlog .warning ("File: %s reason: %s" % (path_leaf (offender ['path' ]), offender ['fail_reason' ]))
140- return len (offenders )
141+ if spdx_offenders :
142+ userlog .warning ("Found files with missing SPDX identifier, please review and fix" )
143+ for offender in spdx_offenders :
144+ userlog .warning ("File: %s reason: %s" % (path_leaf (offender ['path' ]), offender ['fail_reason' ]))
145+ return len (license_offenders )
141146
142147
143148def parse_args ():
0 commit comments