2023-11-01 03:32:09 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-03-22 10:28:44 +00:00
|
|
|
# Copyright (c) 2023-2024 Status Research & Development GmbH. Licensed under
|
2023-11-01 03:32:09 +00:00
|
|
|
# either of:
|
|
|
|
# - Apache License, version 2.0
|
|
|
|
# - MIT license
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except
|
|
|
|
# according to those terms.
|
|
|
|
|
2024-03-22 10:28:44 +00:00
|
|
|
excluded_files="config.yaml|.gitmodules"
|
2023-11-01 03:32:09 +00:00
|
|
|
excluded_extensions="json|md|png|txt|toml|gz|key|rlp"
|
|
|
|
|
|
|
|
current_year=$(date +"%Y")
|
|
|
|
outdated_files=()
|
|
|
|
while read -r file; do
|
|
|
|
if ! grep -qE 'Copyright \(c\) .*'$current_year' Status Research & Development GmbH' "$file"; then
|
|
|
|
outdated_files+=("$file")
|
|
|
|
fi
|
|
|
|
done < <(git diff --name-only --diff-filter=AM --ignore-submodules HEAD^ HEAD | grep -vE '(\.('$excluded_extensions')|'$excluded_files')$' || true)
|
|
|
|
|
|
|
|
if (( ${#outdated_files[@]} )); then
|
|
|
|
echo "The following files do not have an up-to-date copyright year:"
|
|
|
|
for file in "${outdated_files[@]}"; do
|
|
|
|
echo "- $file"
|
|
|
|
done
|
|
|
|
exit 2
|
|
|
|
fi
|