Taskfile.yml in dgit

at main

1version: "3"
2
3vars:
4 GO: go
5 CHECKIMPORTS_FLAGS: ''
6 MISSPELL_FLAGS: -error -locale US
7 STATICCHECK_FLAGS: -checks all,-SA1029,-SA9003,-ST1000,-ST1003,-ST1016,-ST1020,-ST1021,-ST1022,-ST1023
8
9tasks:
10 default:
11 deps: [fast]
12
13 fast:
14 desc: run a fast lint/test suite (default)
15 deps: [goimports, gotest, govet, staticcheck, misspell, unparam]
16
17 full:
18 desc: run a full lint/test suite
19 deps: [default, govulncheck]
20
21 githook:
22 desc: same as "fast," but changes are automatically applied if possible
23 deps: [gotest, govet, staticcheck, unparam]
24 shopt: [globstar]
25 requires:
26 vars: [GO]
27 cmds:
28 - task: goimports
29 vars: {EXTRA_ARGS: -fix}
30 - task: misspell
31 vars: {EXTRA_ARGS: -w}
32
33 goimports:
34 desc: (lint, fast) run goimports
35 preconditions:
36 - sh: command -v goimports
37 msg: run '{{.GO}} install golang.org/x/tools/cmd/goimports@latest' and try again
38 shopt: [globstar]
39 requires:
40 vars: [GO]
41 cmds:
42 - "{{.GO}} run ./devtools/checkimports {{.EXTRA_ARGS}} *.go **/*.go"
43
44 gotest:
45 desc: (lint, fast) run go test
46 requires:
47 vars: [GO]
48 cmds:
49 - "{{.GO}} test ./..."
50
51 govet:
52 desc: (lint, fast) run go vet
53 requires:
54 vars: [GO]
55 cmds:
56 - "{{.GO}} vet ./..."
57
58 staticcheck:
59 desc: (lint, fast) run staticcheck
60 preconditions:
61 - sh: command -v staticcheck
62 msg: run '{{.GO}} install honnef.co/go/tools/cmd/staticcheck@latest' and try again
63 cmds:
64 - staticcheck {{.STATICCHECK_FLAGS}} ./...
65
66 misspell:
67 desc: (lint, fast) run misspell
68 preconditions:
69 - sh: command -v misspell
70 msg: run '{{.GO}} install github.com/client9/misspell/cmd/misspell@latest' and try again
71 shopt: [globstar]
72 cmds:
73 - misspell {{.EXTRA_ARGS}} {{.MISSPELL_FLAGS}} -source go *.go **/*.go
74 - misspell {{.EXTRA_ARGS}} {{.MISSPELL_FLAGS}} CHANGELOG CONTRIBUTING LICENSE README
75
76 unparam:
77 desc: (lint, fast) run unparam
78 preconditions:
79 - sh: command -v unparam
80 msg: run '{{.GO}} install mvdan.cc/unparam@latest' and try again
81 cmds:
82 - unparam ./...
83
84 govulncheck:
85 desc: (lint) run govulncheck
86 preconditions:
87 - sh: command -v govulncheck
88 msg: run '{{.GO}} install golang.org/x/vuln/cmd/govulncheck@latest' and try again
89 cmds:
90 - govulncheck ./...