Skip to content

Commit 993408a

Browse files
committed
add precommit and apply
1 parent cd73f9f commit 993408a

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
# Update hooks to latest versions:
1212
# pre-commit autoupdate
1313

14-
default_language_version:
15-
python: python3.13
16-
1714
repos:
1815
# =============================================================================
1916
# Standard pre-commit hooks
@@ -83,7 +80,6 @@ repos:
8380
rev: 25.1.0
8481
hooks:
8582
- id: black
86-
language_version: python3.13
8783
exclude: |
8884
(?x)^(
8985
vendor/|

scripts/evergreen/check_precommit.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@ initial_index_state=$(git diff --name-only --cached --diff-filter=AM)
66

77
export EVERGREEN_MODE=true
88

9-
# Run pre-commit framework
10-
command -v pre-commit >/dev/null 2>&1 || pip install pre-commit
9+
# Install pre-commit if not available
10+
if ! command -v pre-commit >/dev/null 2>&1; then
11+
echo "Installing pre-commit..."
12+
pip install pre-commit
13+
fi
14+
15+
echo "Running pre-commit hooks..."
16+
17+
# Run pre-commit - it may exit non-zero if it modifies files
18+
# We capture the exit code and handle it appropriately
19+
set +e
1120
pre-commit run --all-files
21+
pre_commit_exit=$?
22+
set -e
1223

13-
echo "Pre-commit hook has completed."
24+
echo "Pre-commit hook has completed successfully."
1425

1526
# Stage any changes made by the pre-commit hook
1627
git add -u

0 commit comments

Comments
 (0)