A collection of pre-commit hooks for various languages and tools to ensure code quality, security, and consistency.
- π Multi-language support: Hooks for Python, JavaScript, Go, Rust, Nix, and more
- π‘οΈ Security scanning: Integration with security tools
- π Code quality: Linting, formatting, and style checks
- π CI/CD ready: Works seamlessly with GitHub Actions
- π¦ Multiple installation methods: pre-commit, npm, pip, or direct download
Add this to your .pre-commit-config.yaml:
repos:
- repo: https://github.com/aRustyDev/pre-commit-hooks
rev: v0.1.0 # Use the latest release
hooks:
- id: shellcheck
- id: shfmt
# Add more hooks as neededThen run:
pre-commit install
pre-commit run --all-filesnpm install --save-dev @arustydev/pre-commit-hookspip install arustydev-pre-commit-hookscurl -sSL https://github.com/aRustyDev/pre-commit-hooks/releases/latest/download/install.sh | bashshellcheck- Shell script analysisshfmt- Shell script formatting
commitizen- Conventional commit messagescommitlint- Commit message lintinggitlint- Git commit message linter
nix-fmt- Nix code formatternix-lint- Nix linternix-build- Nix build validation
eslint- JavaScript lintingjshint- JavaScript code qualityfixmyjs- JavaScript auto-fixingcsslint- CSS lintingscss-lint- SCSS linting
github-action-lint- GitHub Actions workflow linting
yamlfmt- YAML formatting
witness- Supply chain security
# .pre-commit-config.yaml
repos:
- repo: https://github.com/aRustyDev/pre-commit-hooks
rev: v0.1.0
hooks:
# Shell scripts
- id: shellcheck
args: [-x]
- id: shfmt
args: [-i, '2', -ci]
# JavaScript
- id: eslint
files: \.js$
# Commits
- id: commitlint
stages: [commit-msg]# .pre-commit-config.yaml
repos:
- repo: https://github.com/aRustyDev/pre-commit-hooks
rev: v0.1.0
hooks:
# Run on specific files
- id: nix-fmt
files: \.nix$
# Custom arguments
- id: shellcheck
args: [--severity=warning]
# Exclude patterns
- id: eslint
exclude: ^vendor/- Python 3.6+
- Node.js 14+
- Bash 4+
- pre-commit
# Clone the repository
git clone https://github.com/aRustyDev/pre-commit-hooks.git
cd pre-commit-hooks
# Install dependencies
npm install
pip install -e .[dev]
pre-commit install
# Run tests
./tests/run_tests.shSee CONTRIBUTING.md for guidelines.
Tests are written using bats:
# Run all tests
./tests/run_tests.sh
# Run specific test
bats tests/commits/test_gitlint.bats
# Run with coverage
kcov coverage bats tests/This project follows Semantic Versioning. See CHANGELOG.md for release history.
MIT License - see LICENSE file for details.
- Pre-commit framework creators
- All contributors and hook authors
- Open source security tools integrated
- π Report bugs
- π‘ Request features
- π¬ Discussions
- π Documentation