File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -81,17 +81,20 @@ def license_check(directory_name, file):
81
81
found_spdx = True
82
82
83
83
if not found_spdx :
84
- # Issue reported reported here https://github.com/nexB/scancode-toolkit/issues/1913
85
- # We verify here if SPDX is not really there as SDPX is part of the license text
86
- # scancode has some problems detecting it properly
87
- with open (os .path .join (os .path .abspath (license_offender ['file' ]['path' ])), 'r' ) as spdx_file_check :
88
- filetext = spdx_file_check .read ()
89
- matches = re .findall ("SPDX-License-Identifier:?" , filetext )
90
- if matches :
84
+ try :
85
+ # Issue reported here https://github.com/nexB/scancode-toolkit/issues/1913
86
+ # We verify here if SPDX is not really there as SDPX is part of the license text
87
+ # scancode has some problems detecting it properly
88
+ with open (os .path .join (os .path .abspath (license_offender ['file' ]['path' ])), 'r' ) as spdx_file_check :
89
+ filetext = spdx_file_check .read ()
90
+ matches = re .findall ("SPDX-License-Identifier:?" , filetext )
91
+ if matches :
92
+ continue
93
+ license_offender ['reason' ] = MISSING_SPDX_TEXT
94
+ offenders .append (license_offender )
95
+ except UnicodeDecodeError :
96
+ # not valid file for license check
91
97
continue
92
- license_offender ['reason' ] = MISSING_SPDX_TEXT
93
- offenders .append (license_offender )
94
-
95
98
except KeyError :
96
99
userlog .warning ("Invalid scancode json file" )
97
100
return - 1
You can’t perform that action at this time.
0 commit comments