Skip to content

Commit a2184e8

Browse files
committed
chore(dev): add .pre-commit-config with black, ruff, shellcheck; Makefile hook target; docs
1 parent f2f5c90 commit a2184e8

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

.pre-commit-config.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-merge-conflict
8+
- id: check-yaml
9+
10+
- repo: https://github.com/psf/black
11+
rev: 24.8.0
12+
hooks:
13+
- id: black
14+
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: v0.6.3
17+
hooks:
18+
- id: ruff
19+
args: ["--fix"]
20+
21+
- repo: https://github.com/shellcheck-py/shellcheck-py
22+
rev: v0.10.0.1
23+
hooks:
24+
- id: shellcheck
25+
files: "^scripts/.*\\.sh$"

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PY?=python3
22
VENV?=venv
33

4-
.PHONY: bootstrap bootstrap-prod test lint fmt ci chat config clean
4+
.PHONY: bootstrap bootstrap-prod test lint fmt ci chat config hooks clean
55

66
bootstrap:
77
@bash scripts/bootstrap_venv.sh dev $(PY)
@@ -26,6 +26,9 @@ chat:
2626
config:
2727
@$(VENV)/bin/python -m orbit_agent.cli config-info
2828

29+
hooks:
30+
@$(VENV)/bin/pre-commit install && echo "pre-commit hooks installed"
31+
2932
clean:
3033
rm -rf $(VENV) __pycache__ .pytest_cache
3134
find . -name "*.pyc" -delete

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ docker run -p 5000:5000 --env-file .env orbit-agent
127127
## Contributing
128128

129129
```bash
130-
# Install development dependencies
130+
# Install development dependencies
131131
pip install -r requirements-dev.txt
132132

133133
# Run tests
@@ -137,4 +137,12 @@ pytest -q
137137
black .
138138
ruff check .
139139
mypy .
140+
141+
# Optional: set up git hooks (pre-commit)
142+
pre-commit install
143+
# or via Makefile (after bootstrapping venv):
144+
make hooks
145+
146+
# Run all hooks against the repo
147+
pre-commit run -a
140148
```

0 commit comments

Comments
 (0)