mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-02 22:02:13 +08:00
* feat(tool): Adding license header check and apply tool * Update docs/LICENSE_HEADERS.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update scripts/license_header.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
38 lines
834 B
Bash
Executable File
38 lines
834 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Run make lint
|
|
echo "Running linting..."
|
|
make lint
|
|
LINT_RESULT=$?
|
|
|
|
if [ $LINT_RESULT -ne 0 ]; then
|
|
echo "❌ Linting failed. Please fix the issues and try committing again."
|
|
exit 1
|
|
fi
|
|
|
|
# Run make format
|
|
echo "Running formatting..."
|
|
make format
|
|
FORMAT_RESULT=$?
|
|
|
|
if [ $FORMAT_RESULT -ne 0 ]; then
|
|
echo "❌ Formatting failed. Please fix the issues and try committing again."
|
|
exit 1
|
|
fi
|
|
|
|
# Check license headers
|
|
echo "Checking license headers..."
|
|
make check-license-all
|
|
LICENSE_RESULT=$?
|
|
|
|
if [ $LICENSE_RESULT -ne 0 ]; then
|
|
echo "❌ Some files are missing license headers."
|
|
echo "Run 'make add-license-all' to add them automatically."
|
|
exit 1
|
|
fi
|
|
|
|
# If any files were reformatted, add them back to staging
|
|
git diff --name-only | xargs -I {} git add "{}"
|
|
|
|
echo "✅ Pre-commit checks passed!"
|
|
exit 0 |