-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpre_commit.sh
31 lines (26 loc) · 987 Bytes
/
pre_commit.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
echo ""
echo "===================================================="
echo "Running this library's configured pre-commit checks."
echo "See https://pre-commit.com/ for more information."
echo "===================================================="
echo ""
pip install pre-commit
pre-commit install
pushd "${TRAVIS_BUILD_DIR}"
pre-commit run --all-files
PRE_COMMIT_EXIT_CODE=$?
if [ $PRE_COMMIT_EXIT_CODE -ne 0 ]; then
echo ""
echo "====================================================================="
echo "WARNING: One or more pre-commit checks have failed!"
echo "This means you do not have pre-commit set up in your local checkout!"
echo "See https://github.com/pcdshub/pre-commit-hooks/blob/master/README.md"
echo "or use the above output and the following diff to fix the issues"
echo "manually:"
echo "====================================================================="
echo ""
git diff
fi
popd
exit $PRE_COMMIT_EXIT_CODE