-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
147 lines (143 loc) · 4.63 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
135
136
137
138
139
140
141
142
143
144
145
146
147
# ==========================================================================
# Golang Pre-Commit Hooks | https://github.com/tekwizely/pre-commit-golang
#
# !! ALL Hooks enabled by default - Comment out hooks you are not using
#
# Visit the project home page to learn more about the available Hooks,
# including useful arguments you might want to pass into them.
#
# NOTE: When passing options to hooks, if your options contain a reference
# to an existing file, then you will need to use a trailing '--'
# argument to separate the hook options from the modified-file list
# that Pre-Commit passes into the hook.
# For repo-based hooks, '--' is not needed.
#
# NOTE: You can pass environment variables to hooks using args with the
# following format:
#
# --hook:env:NAME=VALUE
#
# Consider adding aliases to longer-named hooks for easier CLI usage.
# ==========================================================================
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-added-large-files
- id: detect-aws-credentials
- id: detect-private-key
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
#
# Go Build
#
- id: go-build-mod
args: ["--hook:env:GOOS=js", "--hook:env:GOARCH=wasm"]
#
# Go Mod Tidy
#
- id: go-mod-tidy
- id: go-mod-tidy-repo
# #
# # Go Test
# #
# - id: go-test-mod
# - id: go-test-pkg
# - id: go-test-repo-mod
# - id: go-test-repo-pkg
# #
# # Go Vet
# #
# - id: go-vet
# args: ["--hook:env:GOOS=js", "--hook:env:GOARCH=wasm"]
- id: go-vet-mod
args: ["--hook:env:GOOS=js", "--hook:env:GOARCH=wasm"]
# - id: go-vet-pkg
# - id: go-vet-repo-mod
# - id: go-vet-repo-pkg
# #
# # Revive
# #
- id: go-revive
args: ["--hook:env:GOOS=js", "--hook:env:GOARCH=wasm"]
# - id: go-revive-mod
# - id: go-revive-repo-mod
#
# GoSec
#
- id: go-sec-mod
# - id: go-sec-pkg
# - id: go-sec-repo-mod
# - id: go-sec-repo-pkg
#
# StaticCheck
#
# SA4006 is disabled because ogen creates content which breaks it...
# ST1000 is disabled because both ogen and sqlc don't create content which is compatible with it
- id: go-staticcheck-mod
args:
[
"--hook:env:GOOS=js",
"--hook:env:GOARCH=wasm",
"-checks",
"all,-SA4006,-ST1000",
]
# - id: go-staticcheck-pkg
# - id: go-staticcheck-repo-mod
# - id: go-staticcheck-repo-pkg
# #
# # StructSlop
# #
# - id: go-structslop-mod
# - id: go-structslop-pkg
# - id: go-structslop-repo-mod
# - id: go-structslop-repo-pkg
# #
# # Formatters
# #
# - id: go-fmt
# - id: go-fmt-repo
# - id: go-fumpt # replaces go-fmt
# - id: go-fumpt-repo # replaces go-fmt-repo
# - id: go-imports # replaces go-fmt
# - id: go-imports-repo # replaces go-fmt-repo
# - id: go-returns # replaces go-imports & go-fmt
# - id: go-returns-repo # replaces go-imports-repo & go-fmt-repo
#
# Style Checkers
#
- id: go-lint
- id: go-critic
# #
# # GolangCI-Lint
# # - Fast Multi-Linter
# # - Can be configured to replace MOST other hooks
# # - Supports repo config file for configuration
# # - https://github.com/golangci/golangci-lint
# #
# - id: golangci-lint
# - id: golangci-lint-mod
# - id: golangci-lint-pkg
# - id: golangci-lint-repo-mod
# - id: golangci-lint-repo-pkg
# #
# # Invoking Custom Go Tools
# # - Configured *entirely* through the `args` attribute, ie:
# # args: [ go, test, ./... ]
# # - Use arg `--hook:error-on-output` to indicate that any output from the tool
# # should be treated as an error.
# # - Use the `name` attribute to provide better messaging when the hook runs
# # - Use the `alias` attribute to be able to invoke your hook via `pre-commit run`
# #
# # - id: my-cmd
# # - id: my-cmd-mod
# # - id: my-cmd-pkg
# # - id: my-cmd-repo
# # - id: my-cmd-repo-mod
# # - id: my-cmd-repo-pkg