forked from piplabs/story
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
86 lines (76 loc) · 2.73 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:
# First check for secrets
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: ["--baseline", ".secrets.baseline"]
exclude: "(pnpm-lock.yaml|testdata|static|config.json|genesis.json)"
# Then run code formatters
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files # No large files
exclude: "lib/netconf/.*/.*"
- id: trailing-whitespace # trims trailing whitespace
exclude: "testdata"
- id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline
exclude_types: ["proto"]
exclude: "(testdata|.gas-snapshot|buf.gen.yaml|lib/netconf/.*/.*)"
- id: mixed-line-ending # ensures that a file doesn't contain a mix of LF and CRLF
- id: no-commit-to-branch # Protect specific branches (default: main/master) from direct checkins
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: go-mod-tidy # Run go mod tidy when go.mod changes
files: go.mod
- id: go-fmt
args: [-w, -s] # simplify code and write result to (source) file instead of stdout
- repo: local
hooks:
- id: run-solidity-lint
name: run-solidity-lint
language: script
entry: .pre-commit/run_solidity_lint.sh
types: [file, solidity]
require_serial: true
# Then run code validators (on the formatted code)
- repo: https://github.com/golangci/golangci-lint # See .golangci.yml for config
rev: v1.59.1
hooks:
- id: golangci-lint
require_serial: true # Don't run this in parallel
# Lint all go files in the repo, since this aligns with github actions.
entry: golangci-lint run --fix
- repo: local
hooks:
- id: run-buf
name: run-buf
language: script
entry: .pre-commit/run_buf.sh
types: [file, proto]
pass_filenames: false
- id: run-go-tests
name: run-go-tests
language: script
require_serial: true # Don't run this in parallel
entry: .pre-commit/run_go_tests.sh
types: [file, go]
- id: run-forge-tests
name: run-forge-tests
language: script
entry: .pre-commit/run_forge_tests.sh
types: [file, solidity]
require_serial: true
- id: run-regexp
name: run-regexp
language: script
entry: .pre-commit/run_regexp.sh
types: [file, go]
exclude: "(_test.go|contracts/bindings/.*|scripts/)"
- id: run-goversion
name: run-goversion
language: script
entry: .pre-commit/run_goversion.sh
pass_filenames: false
types: [file, go]