-
Notifications
You must be signed in to change notification settings - Fork 8
/
.pre-commit-config.yaml
134 lines (133 loc) · 4.05 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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
# Setup: pre-commit install
# Upgrade: pre-commit autoupdate
# Run: pre-commit run --all-files
# https://pre-commit.com/hooks.html
default_language_version:
# force all unspecified python hooks to run python3
python: python3
node: 16.15.0
exclude: |
(?x)(
^.devcontainer/|
^.cache/|
^.artifacts/|
^vendor/|
^vendir.lock.yml$|
vendor/
)
default_stages: [commit, push]
repos:
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
# https://github.com/jumanjihouse/pre-commit-hook-yamlfmt#override-defaults
# https://yaml.readthedocs.io/en/latest/example.html
rev: 0.2.2 # or specific tag
hooks:
- id: yamlfmt
types_or: [yaml]
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '999']
- repo: https://github.com/Yelp/detect-secrets
rev: v1.3.0
hooks:
- name: detect-secrets
id: detect-secrets
stages: [commit]
args:
[
--disable-plugin,
KeywordDetector,
--exclude-files,
.gitleaks.toml,
--exclude-files,
.trunk/trunk.yaml,
]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.27.1 # or higher tag
hooks:
- id: yamllint
types_or: [yaml]
args: [--format, parsable, --strict, --config-file, .yamllint.yaml]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0 # Use the ref you want to point at
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: check-case-conflict
name: Prevent case conflicts
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: mixed-line-ending
name: Normalize line endings to lf
args: [--fix=lf]
- id: fix-byte-order-marker
- id: check-added-large-files
name: No large files, use artifacts for that
- id: check-merge-conflict
name: Prevent merge markers being committed
- id: forbid-new-submodules
name: Don't allow git submodules
pass_filenames: false
- id: no-commit-to-branch
name: Don't commit to main
args: [--branch, master, --branch, main]
pass_filenames: false
- repo: https://gitlab.com/bmares/check-json5
rev: v1.0.0
hooks:
- id:
check-json5
# stages: ['commit']
- repo: local
hooks:
- id: golines
name: go-fmt
description: Run formatter against changed files
entry: golines --base-formatter="gofumpt" -w --max-len=120 --no-reformat-tags
types: [go]
language: system
pass_filenames: true
- id: golangci-lint
name: golangci-lint
description: Fast linters runner for Go.
entry: golangci-lint run --fix --timeout 15s --new-from-rev=HEAD~
types: [go]
language: system
pass_filenames: false
- id: go-test-all
name: go-test-all
description: Run integration tests for go
entry: gotestsum --format pkgname -- -shuffle=on -race -tags integration ./...
stages: [commit]
types: [go]
language: system
pass_filenames: false
verbose: true
- id: go-mod-tidy
name: go-mod-tidy
description: Run go mod tidy
entry: go mod tidy
stages: [commit]
types: [go]
language: golang
pass_filenames: false
verbose: true
# - id: go-mod-vendor
# name: go-mod-vendor
# description: Run go mod vendor
# # entry: #env GOTEST_FLAGS='-tags integration' mage -v go:test
# entry: mod vendor
# stages: [commit]
# types: [go]
# language: golang
# pass_filenames: false
# verbose: true
# TODO: not certain why, but go work sync or go version etc doesn't work here
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.5.1
hooks:
- id: markdownlint-cli2
- repo: https://github.com/zricethezav/gitleaks
rev: v8.11.0
hooks:
- id: gitleaks
name: gitleaks-scan