chore(scripts): add copyright boilerplate verification (#3359)

* chore(scripts): add copyright boilerplate verification system

Signed-off-by: tariq-hasan <[email protected]>

* chore(ci): add boilerplate verification to CI pipeline

Signed-off-by: tariq-hasan <[email protected]>

* chore: regenerate files with year-less copyright headers

Signed-off-by: tariq-hasan <[email protected]>

* refactor(boilerplate): simplify verification logic

Signed-off-by: tariq-hasan <[email protected]>

* chore(boilerplate): add missing copyright headers

Signed-off-by: tariq-hasan <[email protected]>

* ci(boilerplate): move verifier to code-quality workflow and run unit tests

Signed-off-by: tariq-hasan <[email protected]>

* feat(boilerplate): accept license headers with any year and remove year validation logic

Signed-off-by: tariq-hasan <[email protected]>

* feat(boilerplate): add copyright headers to generated Python API

Signed-off-by: tariq-hasan <[email protected]>

* refactor(boilerplate): use block-comment header for generated Go files

Signed-off-by: tariq-hasan <[email protected]>

* feat(boilerplate): verify copyright headers in Rust files

Signed-off-by: tariq-hasan <[email protected]>

---------

Signed-off-by: tariq-hasan <[email protected]>
This commit is contained in:
Tariq Hasan
2026-05-29 10:50:56 +00:00
committed by GitHub
parent 0f4c4be96d
commit 9183dfd24f
572 changed files with 7725 additions and 982 deletions
+12
View File
@@ -67,3 +67,15 @@ if [[ $(uname) == "Darwin" ]]; then
else
sed -i -e "s/__version__.*/__version__ = \"${API_VERSION}\"/" ${PKG_ROOT}/__init__.py
fi
echo "Adding copyright headers to generated Python API models"
BOILERPLATE="${TRAINER_ROOT}/hack/boilerplate/boilerplate.sh.txt"
find "${PKG_ROOT}/models" "${PKG_ROOT}/__init__.py" -name '*.py' -type f | while read -r f; do
if ! head -n 5 "$f" | grep -q "Copyright"; then
tmp="$(mktemp)"
cat "${BOILERPLATE}" > "$tmp"
echo "" >> "$tmp"
cat "$f" >> "$tmp"
mv "$tmp" "$f"
fi
done