-
Notifications
You must be signed in to change notification settings - Fork 2
/
.pre-commit-config.yaml
140 lines (127 loc) · 3.56 KB
/
.pre-commit-config.yaml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# See https://pre-commit.com for more information
# NOTE: must run:
# pip install pre-commit
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# cargo install cargo-machete --locked
# cargo install cargo-deny --locked
# pre-commit install --hook-type pre-commit
# pre-commit install --hook-type pre-push
default_install_hook_types:
- pre-commit
- pre-push
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-added-large-files
stages: [commit, push]
- id: check-merge-conflict
args: ["--assume-in-merge"]
stages: [commit, push]
- id: check-symlinks
stages: [commit, push]
- id: check-toml
stages: [commit, push]
- id: check-yaml
args: ["--allow-multiple-documents"]
stages: [commit, push]
- id: trailing-whitespace
stages: [commit, push]
- repo: local
hooks:
# NOTE: if a false positive occurs and dependency is used that cargo-machete complains about,
# you can ignore it by adding this field in the package's Cargo.toml:
# [package.metadata.cargo-machete]
# ignored = []
- id: cargo-machete
name: cargo-machete
description: list unused cargo dependencies
stages: [commit, push]
entry: cargo
args:
- machete
language: system
types: [file]
files: (\.rs|Cargo\.toml)$
pass_filenames: false
- id: cargo-deny
name: cargo-deny
description: Cargo plugin for linting your dependencies
stages: [commit, push]
entry: cargo
args:
- deny
- check
language: system
types: [file]
files: Cargo\.toml$
pass_filenames: false
- id: cargo-clippy
name: cargo-clippy
description: lint the minimal changed packages in the cargo workspace
stages: [commit]
entry: cargo
args:
- clippy
- --verbose
- --all-features
- --fix
- --allow-dirty
- --allow-staged
- --
- -D
- warnings
language: system
types: [file]
files: (\.rs|Cargo\.toml)$
pass_filenames: false
- id: cargo-clippy
name: cargo-clippy
description: lint the minimal changed packages in the cargo workspace
stages: [push]
entry: cargo
args:
- clippy
- --verbose
- --all-features
- --
- -D
- warnings
language: system
types: [file]
files: (\.rs|Cargo\.toml)$
pass_filenames: false
- id: cargo-fmt
name: cargo-fmt
description: format files with cargo fmt
stages: [commit, push]
entry: cargo fmt
language: system
types: [rust]
args: ["--"]
- id: cargo-doc
name: cargo-doc
description: ensure cargo doc builds
stages: [push]
entry: sh
args:
- -c
- "RUSTDOCFLAGS=\"-D warnings\" cargo doc --all-features"
language: system
types: [file]
files: (\.md|\.rs|Cargo\.toml)$
exclude: (CHANGELOG|DEVELOPMENT)\.md$
pass_filenames: false
- id: cargo-test
name: cargo-test
description: run all tests
stages: [push]
entry: sh
args:
- -c
- "cargo test --all-features"
language: system
types: [file]
files: (\.md|\.rs|Cargo\.toml)$
exclude: (CHANGELOG|DEVELOPMENT)\.md$
pass_filenames: false