ci(pre-commit): add pre-commit

This commit is contained in:
thek4n 2026-06-02 16:19:16 +03:00
parent 341b19a87b
commit 61a8bea41e
2 changed files with 70 additions and 0 deletions

67
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,67 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# - id: no-commit-to-branch
# args: [--branch, master, --branch, main, --pattern, release/.*]
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: mixed-line-ending
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-executables-have-shebangs
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
args: [
"--ignore", "body-is-missing", "--contrib=CT1", "--msg-filename"
]
stages: [commit-msg]
- repo: local
hooks:
- id: clippy
name: clippy
language: system
entry: cargo clippy --release -- -W clippy::all -W clippy::pedantic
pass_filenames: false
always_run: true
- id: audit
name: Security check
language: system
entry: cargo audit
pass_filenames: false
always_run: true
- id: deny
name: Dependency policy check
language: system
entry: cargo deny check
pass_filenames: false
always_run: true
- id: tarpaulin
name: Test coverage gate
language: system
entry: cargo tarpaulin --fail-under 80
pass_filenames: false
always_run: true
- id: cargo-fmt
name: cargo fmt
language: system
entry: cargo fmt --check
pass_filenames: false
always_run: true
- id: check-todos # [NOGREP]
name: check-todos # [NOGREP]
language: system
entry: sh -c "! grep --color=always --binary-files=without-match --dereference-recursive --exclude-dir='notes' --exclude-dir='target' --exclude-dir='node_modules' --exclude-dir='.git' --exclude='.pre-commit-config.yaml' --exclude-dir='venv' 'TODO' | grep -v '[NOGREP]'" # [NOGREP]
pass_filenames: false
always_run: true

3
rust-toolchain.toml Normal file
View File

@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
components = ["clippy", "rustfmt"]