@@ -89,7 +89,8 @@ def license_check(scancode_output_path):
89
89
ReturnCode.ERROR.value if any error in file licenses found
90
90
"""
91
91
92
- offenders = []
92
+ license_offenders = []
93
+ spdx_offenders = []
93
94
try :
94
95
with open (scancode_output_path , 'r' ) as read_file :
95
96
scancode_output_data = json .load (read_file )
@@ -107,13 +108,13 @@ def license_check(scancode_output_path):
107
108
108
109
if not scancode_output_data_file ['licenses' ]:
109
110
scancode_output_data_file ['fail_reason' ] = MISSING_LICENSE_TEXT
110
- offenders .append (scancode_output_data_file )
111
+ license_offenders .append (scancode_output_data_file )
111
112
# check the next file in the scancode output
112
113
continue
113
114
114
115
if not has_permissive_text_in_scancode_output (scancode_output_data_file ['licenses' ]):
115
116
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 )
117
118
118
119
if not has_spdx_text_in_scancode_output (scancode_output_data_file ['licenses' ]):
119
120
# Scancode does not recognize license notice in Python file headers.
@@ -131,13 +132,17 @@ def license_check(scancode_output_path):
131
132
132
133
if not has_spdx_text_in_analysed_file (scanned_file_content ):
133
134
scancode_output_data_file ['fail_reason' ] = MISSING_SPDX_TEXT
134
- offenders .append (scancode_output_data_file )
135
+ spdx_offenders .append (scancode_output_data_file )
135
136
136
- if offenders :
137
+ if license_offenders :
137
138
userlog .warning ("Found files with missing license details, please review and fix" )
138
- for offender in offenders :
139
+ for offender in license_offenders :
139
140
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 )
141
146
142
147
143
148
def parse_args ():
0 commit comments