Skip to content

Commit 342e3d3

Browse files
committed
chore: add automatic validation with precommit on CI side
pre-commit will auto-fix formatting and other minor things in the PRs (server-side!), without bugging contributors. Note how I only added the precommit config file, and the rest of the fixes were auto-contributed by the CI - without bugging the contributors or the maintainers Note that this requires the repo to be enabled in the https://pre-commit.ci/
1 parent 7bc82a2 commit 342e3d3

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
exclude: |
4+
(?x)^(
5+
.+\.(dbc|DBC)
6+
)$
7+
8+
repos:
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v6.0.0
11+
hooks:
12+
- id: check-added-large-files
13+
- id: check-executables-have-shebangs
14+
- id: check-json
15+
- id: check-shebang-scripts-are-executable
16+
exclude: '.+\.rs' # would be triggered by #![some_attribute]
17+
- id: check-symlinks
18+
- id: check-toml
19+
- id: check-yaml
20+
args: [ --allow-multiple-documents ]
21+
- id: destroyed-symlinks
22+
- id: end-of-file-fixer
23+
- id: mixed-line-ending
24+
args: [ --fix=lf ]
25+
- id: trailing-whitespace
26+
27+
- repo: https://github.com/Lucas-C/pre-commit-hooks
28+
rev: v1.5.5
29+
hooks:
30+
- id: forbid-tabs
31+
- id: remove-tabs
32+
33+
- repo: local
34+
hooks:
35+
- id: cargo-fmt
36+
name: Rust Format
37+
description: "Automatically format Rust code with cargo fmt"
38+
entry: sh -c "cargo fmt --all"
39+
language: rust
40+
pass_filenames: false

0 commit comments

Comments
 (0)