Skip to content

Commit

Permalink
license: show SPDX license (more easy to read)
Browse files Browse the repository at this point in the history
  • Loading branch information
kikofernandez committed Nov 21, 2024
1 parent 37cd5de commit 93c4082
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/scan-code.escript
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ execute(Command, Config) ->
ok.

compliance_check(Licenses) when is_list(Licenses) ->
lists:foldl(fun ({Path, License, Copyright}, Acc) ->
lists:foldl(fun ({Path, License, SPDX, Copyright}, Acc) ->
CopyrightResult = check_copyright(Copyright),
LicenseResult = compliance_check(License),
R = lists:foldl(fun (ok, Acc0) -> Acc0;
({error, Msg}, Acc0) -> [{License, Path, Msg} | Acc0]
({error, Msg}, Acc0) -> [{SPDX, Path, Msg} | Acc0]
end, [], [CopyrightResult, LicenseResult]),
R ++ Acc
end, [], Licenses);
Expand Down Expand Up @@ -188,9 +188,10 @@ decode(Filename) ->
fetch_licenses(FolderPath, #{<<"files">> := Files}) ->
lists:filtermap(fun(#{<<"type">> := <<"file">>,
<<"detected_license_expression">> := License,
<<"detected_license_expression_spdx">> := SPDX,
<<"copyrights">> := Copyrights,
<<"path">> := Path}) ->
{true, {string:trim(Path, leading, FolderPath), License, Copyrights}};
{true, {string:trim(Path, leading, FolderPath), License, SPDX, Copyrights}};
(_) ->
false
end, Files).
Expand Down

0 comments on commit 93c4082

Please sign in to comment.