Skip to content

Commit 3296f3d

Browse files
committed
wip
1 parent b5aed9e commit 3296f3d

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

.github/workflows/format-and-lint.yaml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,33 @@ jobs:
2323
with:
2424
python-version: '3.10'
2525

26-
- name: Check format and lint
26+
- name: Cache pre-commit environments
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.cache/pre-commit
30+
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
31+
restore-keys: |
32+
pre-commit-${{ runner.os }}-
33+
34+
- name: Install and setup pre-commit
35+
run: |
36+
echo "Pre-commit version: $(pre-commit --version)"
37+
pre-commit install-hooks
38+
39+
- name: Run pre-commit checks
40+
run: |
41+
echo "Running all pre-commit hooks..."
42+
pre-commit run --all-files --show-diff-on-failure
43+
44+
- name: Check for uncommitted changes
2745
run: |
28-
pip list | grep -E 'ruff|mypy' # show ruff and mypy versions
29-
bash .github/workflows/scripts/check-format-and-lint.sh
46+
if [[ -n $(git status --porcelain) ]]; then
47+
echo "❌ Files were modified by pre-commit hooks. Please run 'pre-commit run --all-files' locally and commit the changes."
48+
echo "Modified files:"
49+
git status --porcelain
50+
echo "Showing diff:"
51+
git diff
52+
exit 1
53+
else
54+
echo "✅ No files were modified - all checks passed!"
55+
fi

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ repos:
55
# Ruff version
66
rev: v0.12.3
77
hooks:
8-
# Run the linter with automatic fixes - uses [tool.ruff] config from pyproject.toml
8+
# Run the linter with fixes (CI will detect if files were modified)
99
- id: ruff-check
10-
name: Ruff linter (with fixes)
10+
name: Ruff linter
1111
args: [--fix]
1212
types_or: [python, pyi, jupyter]
1313
# Run the formatter - uses [tool.ruff] config from pyproject.toml

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ dev = [
3737
"ruff==0.11.0",
3838
"mypy==1.15.0",
3939
"pytest",
40+
"pre-commit",
4041
"types-tabulate",
4142
"types-tqdm",
4243
"pandas",

0 commit comments

Comments
 (0)