Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taskfiles: Rearrange task attributes to match latest style guide. #478

Merged
merged 5 commits into from
Jul 15, 2024

Conversation

Henry8192
Copy link
Collaborator

@Henry8192 Henry8192 commented Jul 12, 2024

Reference

We have a guideline at https://docs.yscope.com/dev-guide/contrib-guides-taskfiles.html#ordering-of-task-attributes for organizing task attributes in Taskfile.

Description

<clp-root>/Taskfile.yml and <clp-root>/lint-task.yml were not formatted properly.

  1. Updated task attributes orders in both files according to the guidelines.

Validation performed

Run checker lint-taskfile.py and observed no format error.
lint-taskfile.zip

@junhaoliao
Copy link
Member

It seem the attributes in task webui is not ordered as specified in the guideline. Did the linter report any error on that?

@Henry8192
Copy link
Collaborator Author

It seem the attributes in task webui is not ordered as specified in the guideline. Did the linter report any error on that?

Strange. Only two errors were generated: core and package.

@junhaoliao
Copy link
Member

It seem the attributes in task webui is not ordered as specified in the guideline. Did the linter report any error on that?

Strange. Only two errors were generated: core and package.

Did you see any error when running the script? I see plenty here because some attrs isn't of type dict.

@junhaoliao
Copy link
Member

junhaoliao commented Jul 12, 2024

Here's the script fixed:
lint-tasks.zip

Please take a look into these errors:

Taskfile.yml: Task 'log-viewer-webui' has unsorted attributes.
	Expected order: ['vars', 'sources', 'dir', 'generates', 'deps', 'cmds']
	Actual order  : ['deps', 'dir', 'vars', 'cmds', 'sources', 'generates']
Taskfile.yml: Task 'webui' has unsorted attributes.
	Expected order: ['vars', 'sources', 'dir', 'platforms', 'generates', 'deps', 'cmds']
	Actual order  : ['deps', 'dir', 'platforms', 'vars', 'cmds', 'sources', 'generates']
Taskfile.yml: Task 'core-submodules' has unsorted attributes.
	Expected order: ['internal', 'vars', 'sources', 'dir', 'generates', 'deps', 'cmds']
	Actual order  : ['internal', 'dir', 'vars', 'deps', 'cmds', 'sources', 'generates']
Taskfile.yml: Task 'download-and-extract-tar' has unsorted attributes.
	Expected order: ['internal', 'label', 'vars', 'requires', 'sources', 'generates', 'deps', 'cmds']
	Actual order  : ['internal', 'requires', 'label', 'vars', 'deps', 'cmds', 'sources', 'generates']
Taskfile.yml: Task 'log-viewer-webui-node-modules' has unsorted attributes.
	Expected order: ['internal', 'vars', 'sources', 'dir', 'generates', 'deps', 'cmds']
	Actual order  : ['internal', 'vars', 'dir', 'deps', 'cmds', 'sources', 'generates']
Taskfile.yml: Task 'meteor' has unsorted attributes.
	Expected order: ['vars', 'run', 'preconditions', 'cmds']
	Actual order  : ['run', 'preconditions', 'vars', 'cmds']
Taskfile.yml: Task 'nodejs' has unsorted attributes.
	Expected order: ['internal', 'vars', 'requires', 'deps', 'cmds']
	Actual order  : ['internal', 'deps', 'requires', 'vars', 'cmds']
Taskfile.yml: Task 'package-tar' has unsorted attributes.
	Expected order: ['internal', 'vars', 'requires', 'sources', 'dir', 'generates', 'deps', 'cmds']
	Actual order  : ['internal', 'requires', 'vars', 'dir', 'deps', 'cmds', 'sources', 'generates']
Taskfile.yml: Task 'package-venv' has unsorted attributes.
	Expected order: ['internal', 'vars', 'sources', 'generates', 'deps', 'cmds']
	Actual order  : ['internal', 'vars', 'deps', 'cmds', 'sources', 'generates']
Taskfile.yml: Task 'python-component' has unsorted attributes.
	Expected order: ['internal', 'label', 'vars', 'requires', 'sources', 'dir', 'generates', 'deps', 'cmds']
	Actual order  : ['internal', 'requires', 'label', 'deps', 'vars', 'dir', 'cmds', 'sources', 'generates']
Taskfile.yml: Task 'webui-node-modules' has unsorted attributes.
	Expected order: ['internal', 'vars', 'sources', 'dir', 'generates', 'deps', 'cmds']
	Actual order  : ['internal', 'vars', 'dir', 'deps', 'cmds', 'sources', 'generates']
Taskfile.yml: Task 'component-venv' has unsorted attributes.
	Expected order: ['internal', 'label', 'vars', 'requires', 'sources', 'dir', 'generates', 'deps', 'cmds']
	Actual order  : ['internal', 'requires', 'label', 'dir', 'vars', 'deps', 'cmds', 'sources', 'generates']
Taskfile.yml: Task 'clean-python-component' has unsorted attributes.
	Expected order: ['internal', 'label', 'requires', 'dir', 'cmds']
	Actual order  : ['internal', 'requires', 'label', 'dir', 'cmds']
Taskfile.yml: Task 'init' has unsorted attributes.
	Expected order: ['internal', 'silent', 'run', 'cmd']
	Actual order  : ['internal', 'run', 'silent', 'cmd']

Also, as we discussed offline, please check https://github.com/y-scope/clp/blob/main/lint-tasks.yml as well.

lint-tasks.yml: Task 'cpp-check' has unsorted attributes.
	Expected order: ['sources', 'dir', 'cmds']
	Actual order  : ['dir', 'cmds', 'sources']
lint-tasks.yml: Task 'cpp-fix' has unsorted attributes.
	Expected order: ['sources', 'dir', 'cmds']
	Actual order  : ['dir', 'cmds', 'sources']
lint-tasks.yml: Task 'js-check' has unsorted attributes.
	Expected order: ['sources', 'cmds']
	Actual order  : ['cmds', 'sources']
lint-tasks.yml: Task 'js-fix' has unsorted attributes.
	Expected order: ['sources', 'cmds']
	Actual order  : ['cmds', 'sources']
lint-tasks.yml: Task 'cpp' has unsorted attributes.
	Expected order: ['internal', 'requires', 'dir', 'deps', 'cmds']
	Actual order  : ['internal', 'requires', 'deps', 'dir', 'cmds']
lint-tasks.yml: Task 'linter-node-modules' has unsorted attributes.
	Expected order: ['internal', 'vars', 'sources', 'dir', 'generates', 'deps', 'cmds']
	Actual order  : ['internal', 'deps', 'dir', 'vars', 'cmds', 'sources', 'generates']
lint-tasks.yml: Task 'venv' has unsorted attributes.
	Expected order: ['internal', 'vars', 'sources', 'generates', 'deps', 'cmds']
	Actual order  : ['internal', 'vars', 'deps', 'cmds', 'sources', 'generates']

@junhaoliao
Copy link
Member

@Henry8192 When you're done with this PR, please also submit another PR to update task attributes here:
https://github.com/y-scope/yscope-docs/blob/1c9227f7608854b6eab5e09410da8c1f666eff22/docs/dev-guide/contrib-guides-taskfiles.md?plain=1#L212

  1. platform -> platforms.
  2. More might be modified depending on some offline discussion results.

@Henry8192
Copy link
Collaborator Author

It seem the attributes in task webui is not ordered as specified in the guideline. Did the linter report any error on that?

Strange. Only two errors were generated: core and package.

Did you see any error when running the script? I see plenty here because some attrs isn't of type dict.

Yeah I thought it was my script config error

Taskfile.yml Outdated Show resolved Hide resolved
Co-authored-by: Junhao Liao <[email protected]>
@junhaoliao junhaoliao changed the title reformat taskfile.yml linting: Reorder task attributes in Taskfile.xml and lint-task.yml. Jul 15, 2024
lint-tasks.yml Outdated Show resolved Hide resolved
@junhaoliao junhaoliao changed the title linting: Reorder task attributes in Taskfile.xml and lint-task.yml. linting: Rearrange task attributes in Taskfile.xml and lint-task.yml. Jul 15, 2024
Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kirkrodrigues kirkrodrigues self-requested a review July 15, 2024 17:13
Copy link
Member

@kirkrodrigues kirkrodrigues left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the PR title, how about:

Taskfiles: Rearrange task attributes to match latest style guide.

The current title implies there's an automated linter which might be a bit misleading.

@junhaoliao junhaoliao changed the title linting: Rearrange task attributes in Taskfile.xml and lint-task.yml. Taskfiles: Rearrange task attributes to match latest style guide. Jul 15, 2024
@junhaoliao junhaoliao merged commit d9607af into y-scope:main Jul 15, 2024
4 checks passed
@Henry8192 Henry8192 deleted the taskfileFormat branch July 16, 2024 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants