repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.13.0
hooks:
- id: commitizen
stages: [commit-msg]
args: ['--config', '.github/commitlint.config.js']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: ^.*\.(md|markdown)$
- id: end-of-file-fixer
exclude: ^.*\.(jpg|png|gif|ico)$
- id: check-yaml
args: [--unsafe]
- id: check-toml
- id: check-json
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-case-conflict
- id: check-merge-conflict
- id: detect-private-key
- id: mixed-line-ending
args: ['--fix=lf']
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.38.0
hooks:
- id: markdownlint
args: ['--fix']
exclude: ^CHANGELOG\.md$
- repo: https://github.com/adrienverge/yamllint
rev: v1.33.0
hooks:
- id: yamllint
args: ['-d', 'relaxed']
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.0
hooks:
- id: gitleaks
- repo: local
hooks:
- id: rust-formatting
name: Rust formatting
entry: cargo fmt --
language: system
files: \.rs$
pass_filenames: false
- id: rust-linting
name: Rust linting
entry: cargo clippy -- -D warnings
language: system
files: \.rs$
pass_filenames: false
- id: rust-test
name: Rust tests
entry: cargo test
language: system
files: \.rs$
pass_filenames: false
stages: [push]
- id: cargo-audit
name: Cargo audit
entry: cargo audit
language: system
pass_filenames: false
stages: [push]
- id: cargo-deny
name: Cargo deny check
entry: cargo deny check
language: system
pass_filenames: false
stages: [push]
- id: cargo-doc
name: Documentation check
entry: cargo doc --no-deps
language: system
files: \.rs$
pass_filenames: false
stages: [push]
- id: version-check
name: Version consistency
entry: bash -c 'grep -q "^version = \"$(grep version Cargo.toml | head -1 | cut -d"\"" -f2)\"" Cargo.toml'
language: system
files: Cargo\.toml$
- id: changelog-updated
name: CHANGELOG updated
entry: bash -c 'git diff --cached --name-only | grep -q "CHANGELOG.md" || (echo "CHANGELOG.md not updated" && exit 1)'
language: system
stages: [commit]
always_run: false
pass_filenames: false
exclude: ^(?!.*feat|fix|perf).*$
default_stages: [commit]
fail_fast: false
verbose: true