@@ -150,6 +150,7 @@ init(#{ input := AnalyzerResult, path := GitRepo } = Args) ->
150
150
~ " end_time" => rfctime (),
151
151
~ " environment" => maps :get (~ " environment" , maps :get (~ " analyzer" , Analyzer )),
152
152
~ " provenances" => [ Provenance ],
153
+ ~ " scan_results" => [],
153
154
~ " scanners" => #{ Id => [] },
154
155
~ " files" => [#{ ~ " provenance" => PP ,
155
156
~ " files" => FilesSha1Sum }]
@@ -231,8 +232,26 @@ scan(#{ input := InputScanResult, strategy := Strategy, tool := Tool, path := Pa
231
232
#{ ~ " scan_results" := ScanResults , ~ " scanners" := Scanners } = InputScanner ,
232
233
233
234
Area = setup_scan_area (InputScanner , Path , Strategy ),
235
+
236
+ Mappings = maps :get (~ " detected_license_mapping" , maps :get (~ " config" , InputScanner , #{}),
237
+ #{ ~ " LicenseRef-scancode-agpl-generic-additional-terms" => ~ " NOASSERTION" ,
238
+ ~ " LicenseRef-scancode-free-unknown" => ~ " NOASSERTION" ,
239
+ ~ " LicenseRef-scancode-generic-cla" => ~ " NOASSERTION" ,
240
+ ~ " LicenseRef-scancode-generic-exception" => ~ " NOASSERTION" ,
241
+ ~ " LicenseRef-scancode-generic-export-compliance" => ~ " NOASSERTION" ,
242
+ ~ " LicenseRef-scancode-generic-tos" => ~ " NOASSERTION" ,
243
+ ~ " LicenseRef-scancode-generic-trademark" => ~ " NOASSERTION" ,
244
+ ~ " LicenseRef-scancode-gpl-generic-additional-terms" => ~ " NOASSERTION" ,
245
+ ~ " LicenseRef-scancode-other-copyleft" => ~ " NOASSERTION" ,
246
+ ~ " LicenseRef-scancode-other-permissive" => ~ " NOASSERTION" ,
247
+ ~ " LicenseRef-scancode-patent-disclaimer" => ~ " NOASSERTION" ,
248
+ ~ " LicenseRef-scancode-unknown" => ~ " NOASSERTION" ,
249
+ ~ " LicenseRef-scancode-unknown-license-reference" => ~ " NOASSERTION" ,
250
+ ~ " LicenseRef-scancode-unknown-spdx" => ~ " NOASSERTION" ,
251
+ ~ " LicenseRef-scancode-warranty-disclaimer" => ~ " NOASSERTION" }),
252
+
234
253
#{ ~ " scanner" := #{ ~ " name" := ScannerName }} = NewScanResult =
235
- scan_area (Area , InputProvenance , Tool ),
254
+ scan_area (Area , InputProvenance , Mappings , Tool ),
236
255
237
256
NewScanners = #{ K => lists :usort ([ScannerName | V ]) || K := V <- Scanners },
238
257
@@ -280,7 +299,7 @@ setup_scan_area(Scanner, GitPath, Strategy) ->
280
299
281
300
TmpDir .
282
301
283
- scan_area (Area , Provenance , " reuse" ) ->
302
+ scan_area (Area , Provenance , _Mappings , " reuse" ) ->
284
303
have_tools ([" reuse" ]),
285
304
StartTime = rfctime (),
286
305
Cmd = " cd " ++ Area ++ " && reuse lint -j" ,
@@ -317,7 +336,7 @@ scan_area(Area, Provenance, "reuse") ->
317
336
~ " licenses" => LS
318
337
}
319
338
};
320
- scan_area (Area , Provenance , " scancode" ) ->
339
+ scan_area (Area , Provenance , Mappings , " scancode" ) ->
321
340
have_tools ([" scancode" ]),
322
341
StartTime = rfctime (),
323
342
ScancodeResultFile = filename :join (Area ," scancode.json" ),
@@ -326,8 +345,8 @@ scan_area(Area, Provenance, "scancode") ->
326
345
io :format (" Running: ~ts~n " , [Cmd ]),
327
346
cmd (Cmd ),
328
347
ScancodeJson = decode (ScancodeResultFile ),
329
- #{ ~ " headers" := [#{ ~ " tool_version" := Vsn }] } = ScancodeJson ,
330
- NewScanResults = get_new_results (ScancodeJson , Area , [] ),
348
+ #{ ~ " headers" := [#{ ~ " tool_version" := Vsn }] } = ScancodeJson ,
349
+ NewScanResults = get_new_results (ScancodeJson , Area , Mappings ),
331
350
332
351
CS = [R || R = #{ ~ " statement" := _ } <- NewScanResults ],
333
352
LS = [R || R = #{ ~ " license" := _ } <- NewScanResults ],
@@ -344,8 +363,8 @@ scan_area(Area, Provenance, "scancode") ->
344
363
}.
345
364
346
365
% % Dig deep into the scancode result and fetch all license and copyright data from it.
347
- get_new_results (#{ ~ " files" := Files }, Mappings , Area ) ->
348
- lists :flatmap (fun (File ) -> get_new_results (File , Mappings , Area ) end , Files );
366
+ get_new_results (#{ ~ " files" := Files }, Area , Mappings ) ->
367
+ lists :flatmap (fun (File ) -> get_new_results (File , Area , Mappings ) end , Files );
349
368
get_new_results (#{ ~ " type" := ~ " file" , ~ " path" := Path ,
350
369
~ " license_detections" := Licenses ,
351
370
~ " copyrights" := Copyrights
0 commit comments