@ -27,14 +27,16 @@ find_files() {
\( -name '*.go' -o -name '*.sh' \)
\( -name '*.go' -o -name '*.sh' \)
}
}
mapfile -t failed_license_header < <( find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License")' )
# 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
if ( ( ${# failed_license_header [@] } > 0 ) ) ; then
echo "Some source files are missing license headers."
echo "Some source files are missing license headers."
printf '%s\n' " ${ failed_license_header [@] } "
printf '%s\n' " ${ failed_license_header [@] } "
exit 1
exit 1
fi
fi
mapfile -t failed_copyright_header < <( find_files | xargs grep -L 'Copyright The Helm Authors.' )
# Use "|| :" to ignore the error code when grep returns empty
failed_copyright_header = ( $( find_files | xargs grep -L 'Copyright The Helm Authors.' || :) )
if ( ( ${# failed_copyright_header [@] } > 0 ) ) ; then
if ( ( ${# failed_copyright_header [@] } > 0 ) ) ; then
echo "Some source files are missing the copyright header."
echo "Some source files are missing the copyright header."
printf '%s\n' " ${ failed_copyright_header [@] } "
printf '%s\n' " ${ failed_copyright_header [@] } "