Files
0ad/source/tools/lint/lint.sh
T
Ralph Sennhauser 19d568d506 Add linter to check for copyright year
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>
2025-04-28 16:14:34 +02:00

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