Skip to content

Commit 7a21fee

Browse files
committed
ci: update pre-commit hook to lint only staged files
- Update pre-commit hook to check only staged Python and markdown files - Add GitHub FUNDING.yml configuration
1 parent 93d8f1c commit 7a21fee

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [jgeluk]

.husky/pre-commit

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
# Run Python linting if Python files exist and ruff is available
2-
if find . -name "*.py" -not -path "./.venv/*" -not -path "./site/*" | grep -q .; then
3-
if command -v uv >/dev/null 2>&1 && uv run ruff --version >/dev/null 2>&1; then
4-
uv run ruff check . || exit 1
5-
uv run ruff format --check . || exit 1
6-
fi
1+
# Run Python linting on staged files if ruff is available
2+
if command -v uv >/dev/null 2>&1 && uv run ruff --version >/dev/null 2>&1; then
3+
git diff --cached --name-only --diff-filter=ACM | grep '\.py$' | while read -r file; do
4+
if [ -f "$file" ]; then
5+
uv run ruff check "$file" || exit 1
6+
uv run ruff format --check "$file" || exit 1
7+
fi
8+
done
79
fi
810

9-
# Run markdown linting
10-
pnpm lint:md || exit 1
11+
# Run markdown linting on staged files only
12+
git diff --cached --name-only --diff-filter=ACM | grep '\.md$' | while read -r file; do
13+
if [ -f "$file" ]; then
14+
pnpm exec markdownlint "$file" --ignore node_modules --ignore .husky --ignore site || exit 1
15+
fi
16+
done

0 commit comments

Comments
 (0)