-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
74 lines (68 loc) · 2.19 KB
/
.pre-commit-config.yaml
File metadata and controls
74 lines (68 loc) · 2.19 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
default_stages: [pre-commit, pre-push, manual]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-symlinks
- id: destroyed-symlinks
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--allow-multiple-documents, --unsafe]
- id: check-toml
- id: check-added-large-files
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
exclude: \.rs$
- id: detect-private-key
exclude: .*tests/.*\.rs$
- id: mixed-line-ending
- id: no-commit-to-branch
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies: ['tomli']
exclude: |
(?x)^(
target/.*
)$
- repo: local
hooks:
- id: rustfmt
name: rustfmt
description: Format Rust code with rustfmt
entry: cargo +nightly fmt --all --
language: system
types: [rust]
pass_filenames: false
- id: clippy
name: clippy
description: Lint Rust code with clippy
entry: cargo clippy --all-targets -- -D warnings
language: system
types: [rust]
pass_filenames: false
- id: branch-name-check
name: Branch naming convention
description: Ensure branch name follows <type>/<desc> or <username>/<desc> format
entry: |
bash -c '
branch=$(git rev-parse --abbrev-ref HEAD)
if [[ "$branch" != "main" && ! "$branch" =~ ^[a-z0-9]([a-z0-9._-]*[a-z0-9])?/[a-z0-9._-]+$ ]]; then
echo "Branch \"$branch\" does not follow naming convention: <type>/<description> or <username>/<description>"
exit 1
fi
'
language: system
stages: [pre-push]
always_run: true
pass_filenames: false
- id: dco-check
name: DCO sign-off check
description: Check that the commit message contains a DCO sign-off
entry: |
bash -c 'grep -q "^Signed-off-by: .* <.*>$" "$1"' --
language: system
stages: [commit-msg]
always_run: true