mirror of
https://github.com/hanzo-ml/trainer.git
synced 2026-09-24 00:31:34 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user