8
8
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/Taskfile.yml
9
9
PROJECT_NAME : " arduino-lint"
10
10
DIST_DIR : " dist"
11
+ # Path of the project's primary Go module:
12
+ DEFAULT_GO_MODULE_PATH : ./
11
13
DEFAULT_GO_PACKAGES :
12
- sh : echo $(go list ./... | grep --invert-match 'github.com/arduino/arduino-lint/internal/rule/schema/schemadata' | tr '\n' ' ')
14
+ sh : |
15
+ echo $( \
16
+ cd {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}} \
17
+ && \
18
+ go list ./... | \
19
+ grep --invert-match 'github.com/arduino/arduino-lint/internal/rule/schema/schemadata' | \
20
+ tr '\n' ' ' \
21
+ || \
22
+ echo '"ERROR: Unable to discover Go packages"' \
23
+ )
13
24
# build vars
14
25
COMMIT :
15
26
sh : echo "$(git log --no-show-signature -n 1 --format=%h)"
@@ -95,6 +106,7 @@ tasks:
95
106
desc : Create all generated documentation content
96
107
deps :
97
108
- task : go:cli-docs
109
+ - task : go:rule-docs
98
110
# Make the formatting consistent with the non-generated Markdown
99
111
- task : general:format-prettier
100
112
@@ -134,6 +146,7 @@ tasks:
134
146
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go-task/Taskfile.yml
135
147
go:build :
136
148
desc : Build the Go code
149
+ dir : " {{.DEFAULT_GO_MODULE_PATH}}"
137
150
cmds :
138
151
- go build -v {{.LDFLAGS}}
139
152
@@ -150,12 +163,14 @@ tasks:
150
163
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
151
164
go:fix :
152
165
desc : Modernize usages of outdated APIs
166
+ dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
153
167
cmds :
154
168
- go fix {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
155
169
156
170
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
157
171
go:format :
158
172
desc : Format Go code
173
+ dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
159
174
cmds :
160
175
- go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
161
176
@@ -172,6 +187,7 @@ tasks:
172
187
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
173
188
go:lint :
174
189
desc : Lint Go code
190
+ dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
175
191
cmds :
176
192
- |
177
193
if ! which golint &>/dev/null; then
@@ -183,9 +199,24 @@ tasks:
183
199
{{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \
184
200
{{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
185
201
202
+ go:rule-docs :
203
+ desc : Generate rules documentation
204
+ dir : ./ruledocsgen
205
+ deps :
206
+ - task : go:rule-docs:build
207
+ cmds :
208
+ - ./ruledocsgen ../docs/rules
209
+
210
+ go:rule-docs:build :
211
+ desc : Generate rules documentation
212
+ dir : ./ruledocsgen
213
+ cmds :
214
+ - go build
215
+
186
216
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-task/Taskfile.yml
187
217
go:test :
188
218
desc : Run unit tests
219
+ dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
189
220
cmds :
190
221
- |
191
222
go test \
@@ -201,13 +232,16 @@ tasks:
201
232
desc : Run integration tests
202
233
deps :
203
234
- task : go:build
235
+ - task : go:rule-docs:build
204
236
- task : poetry:install-deps
205
237
cmds :
206
238
- poetry run pytest tests
239
+ - poetry run pytest ruledocsgen/tests
207
240
208
241
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
209
242
go:vet :
210
243
desc : Check for errors in Go code
244
+ dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
211
245
cmds :
212
246
- go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
213
247
0 commit comments