Skip to content

Commit

Permalink
OPS: print only files in check-copyright.sh -t
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-chacko committed Jun 3, 2024
1 parent 8ea7069 commit a6555ef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/check-copyright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
# -t disables logging and info
-h|--help) usage; exit 0;;
# -t disables logging and info
-t|--terse) exec 3>/dev/null 4>/dev/null 5>&2; shift;;
-t|--terse) exec 3>/dev/null 4>/dev/null 5>&1; wrn() { for arg in "$@"; do :; done; echo "$arg" >&5; }; shift;;
# -q disables logging, info, and warning
-q|--quiet) exec 3>/dev/null 4>/dev/null 5>/dev/null; shift;;
# -v enables logging
-v|--verbose) exec 3>&1 4>&1 5>&2; shift;;
-v|--verbose) exec 3>&1 4>&1 5>&1; shift;;
# -- indicates the explicit end of options, so consume it and exit the loop
--) shift; break;;
# any other option-like string is an error
Expand Down Expand Up @@ -100,7 +100,7 @@
while read filePath; do
[ -f "$filePath" ] || die "Cannot check copyright in non-existent file: '$filePath'"
grep -Eq "SPDX-License-Identifier: Apache-2.0" "$filePath" || {
wrn "👿 License identifier not found: $filePath"
wrn "👿 License identifier not found:" "$filePath"
echo "$filePath"
continue
}
Expand All @@ -109,8 +109,8 @@
existingModifiedYear="$(grep -Eo 'Copyright [0-9]{4} IBM Corporation and' "$filePath" | cut -d ' ' -f 2 )"
case "$existingModifiedYear" in
"$yearModified") continue ;;
"") wrn "🤬 No copyright year in '$filePath': expected '$yearModified'." ;;
*) wrn "😡 Wrong copyright year in '$filePath': expected '$yearModified' but found '$existingModifiedYear'." ;;
"") wrn "🤬 No copyright year (expected '$yearModified'):" "$filePath" ;;
*) wrn "😡 Wrong copyright year (expected '$yearModified' but was '$existingModifiedYear'):" "$filePath" ;;
esac
echo "$filePath"
}
Expand Down

0 comments on commit a6555ef

Please sign in to comment.