-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
120 lines (103 loc) · 2.76 KB
/
.pre-commit-config.yaml
File metadata and controls
120 lines (103 loc) · 2.76 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Pre-commit hooks configuration for TeachLink contract
# Install with: pre-commit install
# Update hooks with: pre-commit autoupdate
# Run manually with: pre-commit run --all-files
repos:
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
name: Trim trailing whitespace
stages: [commit]
- id: end-of-file-fixer
name: Fix end of file
stages: [commit]
- id: check-yaml
name: Check YAML syntax
args: [--unsafe]
stages: [commit]
- id: check-toml
name: Check TOML syntax
stages: [commit]
- id: check-json
name: Check JSON syntax
stages: [commit]
- id: check-merge-conflict
name: Check for merge conflicts
stages: [commit]
- id: check-case-conflict
name: Check for case conflicts
stages: [commit]
- id: detect-private-key
name: Detect private keys
stages: [commit]
- id: mixed-line-ending
name: Fix mixed line endings
args: [--fix=lf]
stages: [commit]
# Rust formatting with rustfmt
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
name: Rustfmt
entry: bash -c 'cargo fmt --all -- --check || (cargo fmt --all && exit 1)'
language: system
types: [rust]
pass_filenames: false
stages: [commit]
# Rust linting with clippy
- id: clippy
name: Clippy
entry: bash -c 'cargo clippy --workspace --all-features -- -D warnings'
language: system
types: [rust]
pass_filenames: false
stages: [commit]
# Security checks
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
name: Detect secrets
args: [--baseline, .secrets.baseline]
stages: [commit]
# Markdown linting
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.35.0
hooks:
- id: markdownlint
name: Markdown lint
stages: [commit]
# Spell checking for documentation
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
name: Codespell (spell checker)
args: [--ignore-words-list=crate, nd, sav]
stages: [commit]
exclude: |
(?x)^(
Cargo.lock|
gas_baseline.json|
gas_thresholds.json
)$
# Configuration for all hooks
default_language_version:
rust: stable
# Files to exclude
exclude: |
(?x)^(
\.git/|
target/|
Cargo.lock|
\.vscode/|
\.idea/|
node_modules/|
build/|
dist/
)$
# Default stages
default_stages: [commit]