Skip to content

Commit f0b93e8

Browse files
committed
add a precommit check
1 parent a0fe7bc commit f0b93e8

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
exclude: ^tests/fixtures/
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v6.0.0
7+
hooks:
8+
- id: check-added-large-files
9+
- id: check-executables-have-shebangs
10+
- id: check-json
11+
exclude: '\.vscode/(cSpell|extensions)\.json' # cSpell.json and extensions.json use comments
12+
- id: check-shebang-scripts-are-executable
13+
exclude: '.+\.rs' # would be triggered by #![some_attribute]
14+
- id: check-symlinks
15+
- id: check-toml
16+
- id: check-yaml
17+
args: [ --allow-multiple-documents ]
18+
- id: destroyed-symlinks
19+
- id: end-of-file-fixer
20+
- id: mixed-line-ending
21+
args: [ --fix=lf ]
22+
- id: trailing-whitespace
23+
24+
- repo: local
25+
hooks:
26+
- id: rust-linting
27+
name: Rust linting
28+
description: Run cargo fmt on files included in the commit.
29+
entry: cargo +stable fmt --
30+
pass_filenames: true
31+
types: [file, rust]
32+
language: system
33+
- id: rust-clippy
34+
name: Rust clippy
35+
description: Run cargo clippy on files included in the commit.
36+
entry: cargo +stable clippy --workspace --all-targets --all-features -- -D warnings
37+
pass_filenames: false
38+
types: [file, rust]
39+
language: system
40+
- id: cspell
41+
name: Code spell checker (cspell)
42+
description: Run cspell to check for spelling errors (if available).
43+
entry: bash -c 'if command -v cspell >/dev/null 2>&1; then cspell --no-must-find-files -- "$@"; else echo "cspell not found, skipping spell check"; exit 0; fi' --
44+
pass_filenames: true
45+
language: system
46+
47+
ci:
48+
skip: [rust-linting, rust-clippy, cargo-lock-check, cspell]

0 commit comments

Comments
 (0)