Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Pre-commit hook: lint check on staged Python files using ruff.
#
# Install once per clone:
# git config core.hooksPath .githooks

set -euo pipefail

STAGED=$(git diff --cached --name-only --diff-filter=ACM | grep '\.py$' || true)

if [ -z "$STAGED" ]; then
exit 0
fi

echo "Running ruff lint check..."

if command -v uv &>/dev/null; then
RUFF="uv run ruff"
else
RUFF="ruff"
fi

if ! $RUFF check $STAGED; then
echo ""
echo "Lint check failed. Fix the issues above, re-stage the files, and commit again."
echo "To auto-fix: $RUFF check --fix $STAGED"
exit 1
fi

echo "Lint check passed."
16 changes: 13 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ Thanks for your interest in contributing!
## Getting Started

```bash
git clone https://github.com/iamvirul/vecgrep
cd vecgrep
uv sync
git clone https://github.com/VecGrep/VecGrep
cd VecGrep
uv sync --extra dev
```

### Install the git hooks

Run once after cloning to enable the pre-commit lint check:

```bash
git config core.hooksPath .githooks
```

This runs `ruff` against staged Python files before every commit and blocks the commit if any violations are found.

## Development

Run the server locally:
Expand Down