Skip to content

Commit a1343ad

Browse files
madeyeclaude
andcommitted
Add pre-commit hook for cargo fmt check
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f23e23d commit a1343ad

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.githooks/pre-commit

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
if ! cargo fmt -- --check 2>/dev/null; then
4+
echo "Error: cargo fmt check failed. Run 'cargo fmt' and stage the changes."
5+
exit 1
6+
fi

CLAUDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44

5+
## Setup
6+
7+
```bash
8+
git config core.hooksPath .githooks # enable pre-commit fmt check
9+
```
10+
511
## Build Commands
612

713
```bash

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ Commands:
121121
4. Authenticated CONNECT requests → TCP tunnel via HTTP upgrade + bidirectional copy
122122
5. Authenticated HTTP requests → forwarded to upstream with proxy headers stripped
123123
124+
## Development
125+
126+
After cloning, enable the pre-commit hook to catch formatting issues before they reach CI:
127+
128+
```bash
129+
git config core.hooksPath .githooks
130+
```
131+
132+
The hook runs `cargo fmt --check` and blocks commits with unformatted code.
133+
124134
## Testing
125135

126136
```bash

0 commit comments

Comments
 (0)