Merge pull request #1 from Saahiti402/Saahiti402-patch-2

Update validate-license.sh
pull/13030/head
Saahiti402 5 months ago committed by GitHub
commit 766305121f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,18 +15,13 @@
# limitations under the License.
set -euo pipefail
IFS=$'\n\t'
# removed -not to reduce complexity
# This function searches for files in the current directory and its subdirectories, excluding specific directories (vendor, testdata, and third_party), and then prints the files with .go or .sh extensions
find_files() {
find . -not \( \
\( \
-wholename './vendor' \
-o -wholename '*testdata*' \
-o -wholename '*third_party*' \
\) -prune \
\) \
\( -name '*.go' -o -name '*.sh' \)
find . \
\( -path './vendor' -o -path '*/testdata/*' -o -path '*/third_party/*' \) -prune -o \
\( -name '*.go' -o -name '*.sh' \) -print
}
# Use "|| :" to ignore the error code when grep returns empty
failed_license_header=($(find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License")' || :))
if (( ${#failed_license_header[@]} > 0 )); then

Loading…
Cancel
Save