Skip to content

Commit c3b5a33

Browse files
committed
Document parameter environment variables in task descriptions
Tasks are provided to perform common project development and maintenance operations. Some of these tasks are configured by setting an environment variable from the invocation. It will be important for the contributor to be aware of these variables when using the task directly (as opposed to via the "umbrella" convenience functions which set the variables as appropriate for the project). Previously, when done at all, the variables where documented in comments in the taskfile. The contributor would only see that information if they looked at the source content of the taskfile, but a contributor would only be expected to do that if they were working on the taskfile source. The documented way for a contributor to learn about the available tasks is by running the `task --list` command. This displays the contents of the task's `desc` field. So the parameter variables must be documented in that field.
1 parent e4b9373 commit c3b5a33

File tree

1 file changed

+44
-20
lines changed

1 file changed

+44
-20
lines changed

Taskfile.yml

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,22 @@ tasks:
289289

290290
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
291291
go:fix:
292-
desc: Modernize usages of outdated APIs
292+
desc: |
293+
Modernize usages of outdated APIs.
294+
Environment variable parameters:
295+
- GO_MODULE_PATH: Path of the Go module root (default: {{.DEFAULT_GO_MODULE_PATH}}).
296+
- GO_PACKAGES: List of Go packages to modernize (default: all packages of the module).
293297
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
294298
cmds:
295299
- go fix {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
296300

297301
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
298302
go:format:
299-
desc: Format Go code
303+
desc: |
304+
Format Go code.
305+
Environment variable parameters:
306+
- GO_MODULE_PATH: Path of the Go module root (default: {{.DEFAULT_GO_MODULE_PATH}}).
307+
- GO_PACKAGES: List of Go packages to modernize (default: all packages of the module).
300308
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
301309
cmds:
302310
- go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
@@ -313,7 +321,11 @@ tasks:
313321

314322
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
315323
go:lint:
316-
desc: Lint Go code
324+
desc: |
325+
Lint Go code
326+
Environment variable parameters:
327+
- GO_MODULE_PATH: Path of the Go module root (default: {{.DEFAULT_GO_MODULE_PATH}}).
328+
- GO_PACKAGES: List of Go packages to modernize (default: all packages of the module).
317329
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
318330
cmds:
319331
- |
@@ -378,7 +390,10 @@ tasks:
378390
379391
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
380392
go:tidy:
381-
desc: Refresh dependency metadata
393+
desc: |
394+
Refresh dependency metadata.
395+
Environment variable parameters:
396+
- GO_MODULE_PATH: Path of the Go module root (default: {{.DEFAULT_GO_MODULE_PATH}}).
382397
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
383398
vars:
384399
GO_VERSION: 1.24.0
@@ -387,7 +402,11 @@ tasks:
387402

388403
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
389404
go:vet:
390-
desc: Check for errors in Go code
405+
desc: |
406+
Check for errors in Go code.
407+
Environment variable parameters:
408+
- GO_MODULE_PATH: Path of the Go module root (default: {{.DEFAULT_GO_MODULE_PATH}}).
409+
- GO_PACKAGES: List of Go packages to test (default: all packages of the module).
391410
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
392411
cmds:
393412
- go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
@@ -458,21 +477,23 @@ tasks:
458477
markdownlint-cli \
459478
"**/*.md"
460479
461-
# Parameter variables:
462-
# - PROJECT_PATH: path of the npm-managed project. Default value: "./"
463480
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
464481
npm:install-deps:
465-
desc: Install dependencies managed by npm
482+
desc: |
483+
Install dependencies managed by npm.
484+
Environment variable parameters:
485+
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
466486
dir: |
467487
"{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}"
468488
cmds:
469489
- npm install
470490

471-
# Parameter variables:
472-
# - PROJECT_PATH: path of the npm-managed project. Default value: "./"
473491
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-npm-task/Taskfile.yml
474492
npm:validate:
475-
desc: Validate npm configuration files against their JSON schema
493+
desc: |
494+
Validate npm configuration files against their JSON schema.
495+
Environment variable parameters:
496+
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
476497
vars:
477498
# Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/package.json
478499
SCHEMA_URL: https://json.schemastore.org/package.json
@@ -636,11 +657,12 @@ tasks:
636657
flake8 \
637658
--show-source
638659
639-
# Parameter variables:
640-
# - SCRIPT_PATH: path of the script to be checked.
641660
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-shell-task/Taskfile.yml
642661
shell:check:
643-
desc: Check for problems with shell scripts
662+
desc: |
663+
Check for problems with shell scripts.
664+
Environment variable parameters:
665+
- SCRIPT_PATH: path of the script to be checked.
644666
cmds:
645667
- |
646668
if [[ "{{.SCRIPT_PATH}}" == "" ]]; then
@@ -659,11 +681,12 @@ tasks:
659681
--format={{default "tty" .SHELLCHECK_FORMAT}} \
660682
"{{.SCRIPT_PATH}}"
661683
662-
# Parameter variables:
663-
# - SCRIPT_PATH: path of the script to be checked.
664684
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-shell-task/Taskfile.yml
665685
shell:check-mode:
666-
desc: Check for non-executable shell scripts
686+
desc: |
687+
Check for non-executable shell scripts.
688+
Environment variable parameters:
689+
- SCRIPT_PATH: path of the script to be checked.
667690
cmds:
668691
- |
669692
if [[ "{{.SCRIPT_PATH}}" == "" ]]; then
@@ -674,11 +697,12 @@ tasks:
674697
- |
675698
test -x "{{.SCRIPT_PATH}}"
676699
677-
# Parameter variables:
678-
# - SCRIPT_PATH: path of the script to be formatted.
679700
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-shell-task/Taskfile.yml
680701
shell:format:
681-
desc: Format shell script files
702+
desc: |
703+
Format shell script files.
704+
Environment variable parameters:
705+
- SCRIPT_PATH: path of the script to be formatted.
682706
cmds:
683707
- |
684708
if [[ "{{.SCRIPT_PATH}}" == "" ]]; then

0 commit comments

Comments
 (0)