From f8965b802ca26ce268e1aaa96bf0dbe361348f13 Mon Sep 17 00:00:00 2001 From: mars Date: Sat, 26 Nov 2022 22:16:12 -0700 Subject: [PATCH] Move check_licenses.sh license fetch outside of src/ loop --- check_licenses.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/check_licenses.sh b/check_licenses.sh index aad8cd3..19da131 100755 --- a/check_licenses.sh +++ b/check_licenses.sh @@ -12,16 +12,16 @@ dir="$(pwd | sed 's/\//\n/g' | tail -n 1)" for toml in $(find "$PWD" -name "Cargo.toml"); do printf "Project: %s\n" "$(tomcat package.name "$toml")" + toml_lic="$(tomcat package.license "$toml")" + if ! test -n "$toml_lic"; then + printf "%s: Missing license information\n" "$(printf "%s\n" "$toml" |\ + sed "s/^.\+$dir\///g")" + continue 2 + fi for file in $(find "$(printf "%s\n" "$toml" |\ sed 's/Cargo\.toml/src/g')" -name "*.rs") do info="$(head -n 2 "$file")" - toml_lic="$(tomcat package.license "$toml")" - if ! test -n "$toml_lic"; then - printf "%s: Missing license information\n" "$(printf "%s\n" "$toml" |\ - sed "s/^.\+$dir\///g")" - continue 2 - fi if ! [ "$toml_lic" = "$(printf "%s\n" "$info" | tail -n 1 |\ sed -n 's/\/\/ SPDX-License-Identifier: //p')" ] then