Skip to content

Commit b692606

Browse files
committed
chore: add pre-commit hook for fmt+clippy, clarify ripgrep crate family in docs
- .githooks/pre-commit: enforces cargo fmt + clippy -Dwarnings before commit - architecture.md: clarify ripgrep crate family relationship (regex/ignore/grep-*)
1 parent 7593e73 commit b692606

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

.githooks/pre-commit

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
# Pre-commit hook: enforces fmt + clippy before every commit.
3+
# Install: git config core.hooksPath .githooks
4+
set -e
5+
6+
echo "==> Running cargo fmt --check..."
7+
cargo fmt --all --check || {
8+
echo "ERROR: cargo fmt check failed. Run 'cargo fmt --all' to fix."
9+
exit 1
10+
}
11+
12+
echo "==> Running cargo clippy (warnings = errors)..."
13+
RUSTFLAGS="-Dwarnings" cargo clippy --workspace --quiet || {
14+
echo "ERROR: clippy check failed. Fix all warnings before committing."
15+
exit 1
16+
}
17+
18+
echo "==> Pre-commit checks passed."

docs/architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@
161161
| # | Function | TypeScript Original | Rust Alternative | Docs |
162162
|---|----------|---------------------|------------------|------|
163163
| 15 | Glob | glob | globset | [docs.rs/globset](https://docs.rs/globset) |
164-
| 16 | Grep/search | ripgrep bindings | regex + ignore (ripgrep family) | [docs.rs/regex](https://docs.rs/regex) |
164+
| 16 | Grep/search | ripgrep bindings | regex + ignore | [docs.rs/regex](https://docs.rs/regex) |
165165
| 17 | Gitignore | -- | ignore | [docs.rs/ignore](https://docs.rs/ignore) |
166166
| 18 | File watching | chokidar | notify | [docs.rs/notify](https://docs.rs/notify) |
167167
| 19 | Diff | diff | similar | [docs.rs/similar](https://docs.rs/similar) |
168168
| 20 | File locking | proper-lockfile | fd-lock | [docs.rs/fd-lock](https://docs.rs/fd-lock) |
169169

170-
> Note: #16 currently uses `regex` + `ignore` (both from the ripgrep project). For full ripgrep-compatible behavior (binary detection, encoding, context lines), consider upgrading to `grep-searcher` + `grep-regex` from the same project.
170+
> Note on #16: ripgrep is built from a family of crates by BurntSushi: `regex` (pattern engine), `ignore` (gitignore-aware directory walker), `grep-searcher` (binary detection + encoding + line matching), `grep-regex` (regex adapter). We currently use the lower-level `regex` + `ignore` directly. For full ripgrep-compatible behavior, upgrading to `grep-searcher` + `grep-regex` is a future option.
171171
172172
### 3.5 System / Process
173173

0 commit comments

Comments
 (0)