-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
100 lines (88 loc) · 2.5 KB
/
Taskfile.yml
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
# See LICENSE file for copyright and license details
version: "3"
vars:
GO: go
CHECKIMPORTS_FLAGS: ''
MISSPELL_FLAGS: -error -locale US
STATICCHECK_FLAGS: -checks all,-SA1029,-SA9003,-ST1000,-ST1003,-ST1016,-ST1020,-ST1021,-ST1022,-ST1023
tasks:
default:
cmds:
- task: fast
fast:
desc: run a fast lint/test suite (default)
cmds:
- task: goimports
- task: gotest
- task: govet
- task: staticcheck
- task: misspell
- task: unparam
ci:
desc: run a full lint/test suite
cmds:
- task: default
- task: govulncheck
githook:
desc: same as "fast," but changes are automatically applied if possible
deps: [gotest, govet, staticcheck, unparam]
shopt: [globstar]
requires:
vars: [GO]
cmds:
- task: goimports
vars: {EXTRA_ARGS: -fix}
- task: misspell
vars: {EXTRA_ARGS: -w}
goimports:
desc: (lint, fast) run goimports
preconditions:
- sh: command -v goimports
msg: run '{{.GO}} install golang.org/x/tools/cmd/goimports@latest' and try again
shopt: [globstar]
requires:
vars: [GO]
cmds:
- "{{.GO}} run ./devtools/checkimports {{.EXTRA_ARGS}} *.go **/*.go"
gotest:
desc: (lint, fast) run go test
requires:
vars: [GO]
cmds:
- "{{.GO}} test ./..."
govet:
desc: (lint, fast) run go vet
requires:
vars: [GO]
cmds:
- "{{.GO}} vet ./..."
staticcheck:
desc: (lint, fast) run staticcheck
preconditions:
- sh: command -v staticcheck
msg: run '{{.GO}} install honnef.co/go/tools/cmd/staticcheck@latest' and try again
cmds:
- staticcheck {{.STATICCHECK_FLAGS}} ./...
misspell:
desc: (lint, fast) run misspell
preconditions:
- sh: command -v misspell
msg: run '{{.GO}} install github.com/client9/misspell/cmd/misspell@latest' and try again
shopt: [globstar]
cmds:
- misspell {{.EXTRA_ARGS}} {{.MISSPELL_FLAGS}} -source go *.go **/*.go
- misspell {{.EXTRA_ARGS}} {{.MISSPELL_FLAGS}} CHANGELOG CONTRIBUTING LICENSE README
unparam:
desc: (lint, fast) run unparam
preconditions:
- sh: command -v unparam
msg: run '{{.GO}} install mvdan.cc/unparam@latest' and try again
cmds:
- unparam ./...
govulncheck:
desc: (lint) run govulncheck
preconditions:
- sh: command -v govulncheck
msg: run '{{.GO}} install golang.org/x/vuln/cmd/govulncheck@latest' and try again
cmds:
- govulncheck ./...