Skip to content

Commit 91b353c

Browse files
committed
chore: add pre-commit check script and contributing guide
- Add scripts/check.sh for running all checks locally - Add CONTRIBUTING.md with development workflow - Document pre-commit checklist (build, fmt, clippy, test, doc) - Enforce running checks before pushing to CI This ensures we catch issues locally before wasting CI resources. Usage: ./scripts/check.sh Quality checks: ✅ Build successful ✅ Formatting verified ✅ Clippy passed (zero warnings) ✅ All tests passed (35 tests) ✅ Documentation built
1 parent 6daf392 commit 91b353c

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

CONTRIBUTING.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Contributing to RASN
2+
3+
## Development Workflow
4+
5+
### Before Every Commit
6+
7+
**Always run the pre-commit checks locally:**
8+
9+
```bash
10+
./scripts/check.sh
11+
```
12+
13+
Or manually run each step:
14+
15+
```bash
16+
# 1. Build
17+
cargo build --all-features
18+
19+
# 2. Format check
20+
cargo fmt --all -- --check
21+
22+
# 3. Clippy (linting)
23+
cargo clippy --all-targets --all-features -- -D warnings
24+
25+
# 4. Tests
26+
cargo test --all-features
27+
28+
# 5. Documentation
29+
cargo doc --no-deps --all-features
30+
```
31+
32+
### Auto-formatting
33+
34+
To automatically fix formatting issues:
35+
36+
```bash
37+
cargo fmt --all
38+
```
39+
40+
### Running Benchmarks
41+
42+
```bash
43+
# Run all benchmarks
44+
cargo bench
45+
46+
# Run specific benchmark
47+
cargo bench --bench arrow_lookup
48+
```
49+
50+
### Quality Standards
51+
52+
- **Zero warnings**: All code must compile without warnings
53+
- **Zero clippy violations**: Fix all clippy suggestions
54+
- **All tests passing**: 100% test success required
55+
- **Formatted code**: Run `cargo fmt` before committing
56+
- **Documentation**: Public APIs must have doc comments
57+
58+
### Git Workflow
59+
60+
1. Create feature branch: `git checkout -b feature/issue-X-description`
61+
2. Make changes
62+
3. **Run checks locally**: `./scripts/check.sh`
63+
4. Commit: `git commit -m "feat(scope): description"`
64+
5. Push: `git push origin feature/issue-X-description`
65+
6. Create PR
66+
7. Wait for CI to pass
67+
8. Merge with squash
68+
69+
### Commit Message Format
70+
71+
```
72+
<type>(<scope>): <subject>
73+
74+
<body>
75+
76+
Fixes #<issue-number>
77+
```
78+
79+
**Types:**
80+
- `feat`: New feature
81+
- `fix`: Bug fix
82+
- `docs`: Documentation changes
83+
- `test`: Test additions/changes
84+
- `refactor`: Code refactoring
85+
- `perf`: Performance improvements
86+
- `chore`: Maintenance tasks
87+
88+
**Examples:**
89+
```
90+
feat(arrow): add SIMD AVX2 acceleration
91+
fix(db): correct RocksDB API usage
92+
docs(readme): update installation instructions
93+
test(resolver): add cache expiry tests
94+
```
95+
96+
## Running CI Checks Locally
97+
98+
Our CI runs on:
99+
- Ubuntu (Linux)
100+
- macOS
101+
- Windows
102+
103+
All checks must pass on your local machine before pushing.
104+
105+
## Need Help?
106+
107+
- Check existing issues
108+
- Read the documentation in `/docs`
109+
- Ask questions in discussions

scripts/check.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
echo "🔍 Running pre-commit checks..."
5+
echo ""
6+
7+
echo "📦 Building all packages..."
8+
cargo build --all-features
9+
echo "✅ Build successful"
10+
echo ""
11+
12+
echo "🧹 Checking formatting..."
13+
cargo fmt --all -- --check
14+
echo "✅ Formatting check passed"
15+
echo ""
16+
17+
echo "📎 Running clippy..."
18+
cargo clippy --all-targets --all-features -- -D warnings
19+
echo "✅ Clippy passed"
20+
echo ""
21+
22+
echo "🧪 Running all tests..."
23+
cargo test --all-features
24+
echo "✅ All tests passed"
25+
echo ""
26+
27+
echo "📚 Building documentation..."
28+
cargo doc --no-deps --all-features
29+
echo "✅ Documentation built"
30+
echo ""
31+
32+
echo "✨ All checks passed! Safe to commit and push."

0 commit comments

Comments
 (0)