Skip to content

Commit

Permalink
More scancode fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
garazdawi committed Jan 22, 2025
1 parent b15ef2a commit 4c31fd5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
18 changes: 18 additions & 0 deletions erts/emulator/zstd/update.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
#!/bin/bash
#
# %CopyrightBegin%
#
# Copyright Ericsson AB 2025. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# %CopyrightEnd%

cd $ERL_TOP/erts/emulator/zstd

Expand Down
19 changes: 14 additions & 5 deletions scripts/scan-code.escript
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,20 @@ execute(Command, Config) ->
maps:get(sarif, Config) =/= undefined andalso
sarif(maps:get(sarif, Config), Errors),

Errors =/= [] andalso begin
[io:format("~p~n", [Error]) || Error <- Errors],
erlang:raise(exit, Errors, [])
end,
ok.
SortedErrors = lists:sort(
fun(#{ msg := AMsg } = A, #{ msg := BMsg } = B) ->
if AMsg =:= BMsg ->
A =< B;
true ->
AMsg =< BMsg
end
end, Errors),

[io:format("~ts:\n Msg: ~p\n License: ~ts\n SPDX: ~ts\n", [Path, Msg, License, Spdx]) ||
#{ msg := Msg, spdx := Spdx, license := License, path := Path } <- SortedErrors],

Errors =/= [] andalso erlang:raise(exit, SortedErrors, []),
ok.

compliance_check(Licenses) when is_list(Licenses) ->
lists:foldl(fun ({Path, License, SPDX0, Copyright}, Acc) ->
Expand Down

0 comments on commit 4c31fd5

Please sign in to comment.