88 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/Taskfile.yml
99 PROJECT_NAME : " arduino-lint"
1010 DIST_DIR : " dist"
11+ # Path of the project's primary Go module:
12+ DEFAULT_GO_MODULE_PATH : ./
1113 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+ )
1324 # build vars
1425 COMMIT :
1526 sh : echo "$(git log --no-show-signature -n 1 --format=%h)"
@@ -95,6 +106,7 @@ tasks:
95106 desc : Create all generated documentation content
96107 deps :
97108 - task : go:cli-docs
109+ - task : go:rule-docs
98110 # Make the formatting consistent with the non-generated Markdown
99111 - task : general:format-prettier
100112
@@ -134,6 +146,7 @@ tasks:
134146 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go-task/Taskfile.yml
135147 go:build :
136148 desc : Build the Go code
149+ dir : " {{.DEFAULT_GO_MODULE_PATH}}"
137150 cmds :
138151 - go build -v {{.LDFLAGS}}
139152
@@ -150,12 +163,14 @@ tasks:
150163 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
151164 go:fix :
152165 desc : Modernize usages of outdated APIs
166+ dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
153167 cmds :
154168 - go fix {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
155169
156170 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
157171 go:format :
158172 desc : Format Go code
173+ dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
159174 cmds :
160175 - go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
161176
@@ -172,6 +187,7 @@ tasks:
172187 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
173188 go:lint :
174189 desc : Lint Go code
190+ dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
175191 cmds :
176192 - |
177193 if ! which golint &>/dev/null; then
@@ -183,9 +199,24 @@ tasks:
183199 {{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \
184200 {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
185201
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+ 186216 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-task/Taskfile.yml
187217 go:test :
188218 desc : Run unit tests
219+ dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
189220 cmds :
190221 - |
191222 go test \
@@ -201,13 +232,16 @@ tasks:
201232 desc : Run integration tests
202233 deps :
203234 - task : go:build
235+ - task : go:rule-docs:build
204236 - task : poetry:install-deps
205237 cmds :
206238 - poetry run pytest tests
239+ - poetry run pytest ruledocsgen/tests
207240
208241 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
209242 go:vet :
210243 desc : Check for errors in Go code
244+ dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
211245 cmds :
212246 - go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
213247
0 commit comments