-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
121 lines (112 loc) · 3.44 KB
/
.pre-commit-config.yaml
File metadata and controls
121 lines (112 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Pre-commit configuration for Rust project
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
# Built-in hooks
- 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-json
- id: check-added-large-files
args: ["--maxkb=1000"]
- id: check-merge-conflict
- id: check-case-conflict
- id: mixed-line-ending
- id: detect-private-key
# Rust formatting and linting
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
name: Rust fmt
description: Format Rust code with rustfmt
- id: clippy
name: Rust clippy
description: Lint Rust code with clippy
args: ["--all-targets", "--all-features", "--", "-D", "warnings"]
- id: cargo-check
name: Cargo check
description: Check Rust code with cargo check
# Markdown linting
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.45.0
hooks:
- id: markdownlint
args: ["--fix"]
exclude: '^(CHANGELOG\.md|target/)'
# Git commit message validation
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args:
[
optional-scope,
feat,
fix,
docs,
style,
refactor,
perf,
test,
build,
ci,
chore,
revert,
]
# Additional security checks for Rust
- repo: local
hooks:
- id: cargo-audit
name: Cargo audit
description: Check for security vulnerabilities in dependencies
entry: bash
args:
[
"-c",
'command -v cargo-audit >/dev/null 2>&1 && cargo audit || echo "cargo-audit not installed, skipping..."',
]
language: system
files: Cargo\.(toml|lock)$
pass_filenames: false
- id: cargo-deny
name: Cargo deny
description: Check dependencies against policy
entry: bash
args:
[
"-c",
'command -v cargo-deny >/dev/null 2>&1 && cargo deny check || echo "cargo-deny not installed, skipping..."',
]
language: system
files: (Cargo\.(toml|lock)|deny\.toml)$
pass_filenames: false
- id: cargo-outdated
name: Cargo outdated
description: Check for outdated dependencies
entry: bash
args:
[
"-c",
'command -v cargo-outdated >/dev/null 2>&1 && cargo outdated --exit-code 1 || echo "cargo-outdated not installed, skipping..."',
]
language: system
files: Cargo\.(toml|lock)$
pass_filenames: false
stages: [manual] # Only run manually with --hook-stage manual
# Configuration for specific hooks
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ""
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
autoupdate_schedule: weekly
skip: [cargo-audit, cargo-deny, cargo-outdated] # Skip these in CI and local runs (they take too long)
submodules: false