First off, thank you for considering contributing to husky-rs.
If your contribution is not straightforward, please first discuss the change you wish to make by creating a new issue before making the change.
Before reporting an issue on the issue tracker, please check that it has not already been reported by searching for some related keywords.
Try to do one pull request per change.
Update the changes you have made in CHANGELOG file under the Unreleased section.
Add the changes of your pull request to one of the following subsections, depending on the types of changes defined by Keep a changelog:
Addedfor new features.Changedfor changes in existing functionality.Deprecatedfor soon-to-be removed features.Removedfor now removed features.Fixedfor any bug fixes.Securityin case of vulnerabilities.
If the required subsection does not exist yet under Unreleased, create it!
Clone the repository and run tests:
git clone https://github.com/pplmx/husky-rs
cd husky-rs
cargo testWe follow standard Rust conventions:
# Format code
cargo fmt
# Run linter
cargo clippy --all-targets --all-features -- -D warnings
# Check all at once
make clippy # or cargo clippy --fix --allow-dirtyGuidelines:
- Use meaningful variable names
- Add doc comments for public items
- Keep functions focused and small
- Prefer explicit over clever code
All contributions must include appropriate tests:
For new features:
- Add unit tests in the same file
- Add integration tests in
tests/ - Update or add examples in
docs/examples.md
For bug fixes:
- Add regression test demonstrating the bug
- Ensure fix makes the test pass
Running tests:
# All tests
cargo test
# Specific test
cargo test test_name
# With verbose output
cargo test -- --nocapg
# Integration tests only
cargo test --test test_husky
# CLI tests (requires cli feature)
cargo test --features=cli --test test_cliWe use Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Adding or updating testsrefactor: Code change that neither fixes a bug nor adds a featureperf: Performance improvementchore: Changes to build process or auxiliary tools
Examples:
feat(cli): add list command
docs: update installation instructions
fix(build): handle empty hook files correctly
test(lib): add tests for should_skip_installation
-
Create a feature branch:
git checkout -b feat/my-new-feature
-
Make your changes
-
Test thoroughly:
cargo test --all-features cargo clippy --all-targets --all-features cargo fmt --check -
Commit with conventional format:
git commit -m "feat(scope): add new feature" -
Push and create PR:
git push origin feat/my-new-feature
# Build docs
cargo doc --no-deps
# Open in browser
cargo doc --no-deps --open
# Check for broken links
cargo doc --no-deps 2>&1 | grep warningSee the Makefile for all available commands:
make help # Show all commands
make build # Build release
make test # Run tests
make fmt # Format code
make clippy # Run linter
make fix # Auto-fix issues
make doc # Generate docs
make clean # Clean build artifacts