-
Notifications
You must be signed in to change notification settings - Fork 20
/
.pre-commit-config.yaml
86 lines (83 loc) · 3.31 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 # Use the latest version
hooks:
- id: trailing-whitespace
args: [ --markdown-linebreak-ext=md ] # Preserves markdown line breaks
description: Removes trailing whitespace from files
types: [ text, rust ] # Runs on text files and Rust files specifically
exclude: '\.(ico|jpg|png|gif|eot|svg|ttf|woff|woff2)$' # Skip binary files
- id: check-added-large-files
args: [ '--maxkb=500' ]
description: Prevents giant files from being committed
- id: check-case-conflict
description: Checks for files with names that would conflict on case-insensitive filesystems
- id: check-merge-conflict
description: Checks for files containing merge conflict strings
- id: check-symlinks
description: Checks for symlinks pointing nowhere
- id: detect-private-key
description: Detects presence of private keys
- id: check-yaml
description: Validates YAML files
- id: check-toml
- id: mixed-line-ending
args: [ --fix=lf ]
description: Replaces mixed line endings with LF
- id: check-executables-have-shebangs
description: Ensures executable files have shebangs
- id: pretty-format-json
args: [ --autofix, --no-sort-keys ]
description: Checks that JSON files are properly formatted
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-toml
args: [ --autofix ]
description: Formats TOML files
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- id: forbid-crlf
description: Prevents CRLF line endings
- id: remove-tabs
description: Replaces tabs with spaces
- repo: local
hooks:
- id: cargo-fmt
name: cargo fmt
description: Format files with rustfmt
entry: cargo +nightly fmt --
language: system
types: [ rust ]
pass_filenames: true
# - id: cargo-test
# name: cargo test
# description: Run cargo tests
# entry: cargo nextest run
# language: system
# types: [rust]
# pass_filenames: false
# verbose: true
# - id: cargo-clippy
# name: cargo clippy
# description: Lint Rust code with Clippy
# entry: bash -c 'cargo clippy --workspace --all-targets --all-features -- -D warnings || (echo "Regular clippy failed, attempting to fix..." && cargo clippy --workspace --all-targets --all-features --fix --allow-dirty --allow-staged -- -D warnings)'
# language: system
# types: [rust]
# pass_filenames: false # Clippy should check the entire project
# verbose: true
- id: cargo-machete
name: cargo machete
description: Find unused dependencies in Cargo.toml
entry: cargo machete
language: system
types: [ rust ]
pass_filenames: false
- id: cargo-deny
name: cargo deny check
description: Check dependencies for license/security issues
entry: cargo deny check
language: system
types: [ rust ]
pass_filenames: false