mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:29:50 +00:00
19d568d506
This replaces the previous arclint linter for checking the copyright year in license headers with a gitea workflow job. As the date of last edit might differ from commit date due to reverts the copyright linter is run against a base commit. The python script doing the heavy lifting is written by @Dunedan. Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com> Co-Authored-by: Dunedan <dunedan@phoenitydawn.de>
43 lines
680 B
Bash
Executable File
43 lines
680 B
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
case "$1" in
|
|
--diff)
|
|
commitish=$2
|
|
args="${args} --diff $2"
|
|
shift
|
|
;;
|
|
-j*)
|
|
args="${args} $1"
|
|
;;
|
|
*)
|
|
printf "Unknown option: %s\n\n" "$1"
|
|
exit 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
has_errors=false
|
|
|
|
if command -v cppcheck >/dev/null; then
|
|
# shellcheck disable=SC2086
|
|
./cppcheck/cppcheck.sh ${args} || has_errors=true
|
|
else
|
|
echo "Cppcheck not found in path"
|
|
fi
|
|
|
|
if [ -n "${commitish}" ]; then
|
|
# shellcheck disable=SC2086
|
|
copyright/copyright.sh --from ${commitish} || has_errors=true
|
|
else
|
|
"Skipping copyright linter as no base commit was defined"
|
|
fi
|
|
|
|
if [ ${has_errors} = true ]; then
|
|
exit 1
|
|
fi
|