-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
96 lines (89 loc) · 3.15 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
96 lines (89 loc) · 3.15 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
repos:
- repo: local
hooks:
# ---------------------------------------------
# Version check: ensure versions match between Cargo.toml files
# ---------------------------------------------
- id: version-check
name: "check versions consistency"
entry: bash -c "./scripts/check_versions.sh"
language: system
files: Cargo\.toml$
pass_filenames: false
always_run: true
fail_fast: true
# ---------------------------------------------
# Rust formatting: ensure code is formatted with rustfmt.
# ---------------------------------------------
- id: cargo-fmt
name: "cargo fmt --check"
entry: bash -c "cargo fmt --all -- --check"
language: system
types: [rust]
always_run: true
fail_fast: true
# ---------------------------------------------
# Rust linter: fail commit if clippy reports warnings.
# ---------------------------------------------
- id: cargo-clippy
name: "cargo clippy"
entry: bash -c "cargo xclippy"
language: system
types: [rust]
always_run: true
fail_fast: true
# ---------------------------------------------
# Run unit tests on every commit
# ---------------------------------------------
- id: cargo-test
name: "cargo test"
entry: bash -c "cargo nextest run -r --workspace --all-targets --all-features"
language: system
types: [rust]
pass_filenames: false
always_run: true
fail_fast: true
# ---------------------------------------------
# Check examples compilation
# ---------------------------------------------
- id: cargo-check-examples
name: "cargo check --examples"
entry: bash -c "cargo check --examples"
language: system
types: [rust]
pass_filenames: false
always_run: true
fail_fast: true
# ---------------------------------------------
# Check for unused dependencies
# ---------------------------------------------
- id: cargo-machete
name: "cargo machete"
entry: bash -c "cargo machete --skip-target-dir"
language: system
types: [rust]
pass_filenames: false
always_run: true
fail_fast: true
# ---------------------------------------------
# Check README.md is up to date
# ---------------------------------------------
- id: cargo-readme
name: "cargo readme"
entry: bash -c "cargo readme --no-license > /tmp/README.md && diff -q /tmp/README.md README.md"
language: system
types: [rust]
pass_filenames: false
always_run: true
fail_fast: true
# ---------------------------------------------
# Check YAML formatting with prettier
# ---------------------------------------------
- id: prettier-yaml
name: "prettier --check yaml"
entry: bash -c "prettier --check '**/*.{yaml,yml}'"
language: system
types: [yaml]
pass_filenames: false
always_run: true
fail_fast: true