File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ htmlcov
1313.pytest_cache /
1414.mypy_cache /
1515.ruff_cache /
16+ * .egg-info
1617
1718# Visual Studio Code
1819.vscode /
Original file line number Diff line number Diff line change 1+ set -euo pipefail
2+
3+ # Call block to block the commit with a message.
4+ block() {
5+ echo "$@"
6+ echo "Commit blocked - see errors above."
7+ exit 1
8+ }
9+
10+ # Add all check functions to this space separated list.
11+ # They are executed in this order (see end of file).
12+ CHECKS="fmt lint"
13+
14+ # Run fmt against changed files compared to origin/main
15+ fmt() {
16+ echo "==> Running fmt on all files"
17+ make fmt || block "Formatting failed"
18+
19+ # Re-add any files that were changed by the fixers
20+ git add -u
21+ }
22+
23+ lint() {
24+ echo "==> Running lint on all files"
25+ make lint || block "Linting failed"
26+
27+ # Re-add any files that were changed by the fixers
28+ git add -u
29+ }
30+
31+ for CHECK in $CHECKS; do
32+ # Force each check into a subshell to avoid crosstalk.
33+ ( $CHECK ) || exit $?
34+ done
You can’t perform that action at this time.
0 commit comments