repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
args: ['--maxkb=1024']
- id: detect-private-key
- repo: https://github.com/crate-ci/typos
rev: v1.28.0
hooks:
- id: typos
- repo: local
hooks:
- id: cargo-fmt
name: cargo fmt --check
entry: bash -c 'cargo fmt --all -- --check'
language: system
types: [rust]
pass_filenames: false
- id: cargo-clippy
name: cargo clippy (-D warnings)
entry: bash -c 'cargo clippy --all-targets --all-features -- -D warnings'
language: system
types: [rust]
pass_filenames: false
- id: cargo-deny
name: cargo deny check (license/advisory/ban)
entry: bash -c 'cargo deny check 2>/dev/null || { echo "→ 先运行: cargo install cargo-deny && cargo deny init"; exit 1; }'
language: system
files: 'Cargo\.(toml|lock)'
pass_filenames: false