-
Notifications
You must be signed in to change notification settings - Fork 12
chore: Add Taskfile tasks to lint YAML files. #3
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Build-related directories and files | ||
| .task | ||
| build | ||
|
|
||
| # IDE-related directories and files | ||
| .idea |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "tools/yscope-dev-utils"] | ||
| path = tools/yscope-dev-utils | ||
| url = https://github.com/y-scope/yscope-dev-utils.git |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| extends: "tools/yscope-dev-utils/lint-configs/.yamllint.yml" | ||
|
|
||
| ignore: | | ||
| build/ | ||
| tools/yscope-dev-utils/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Contributing | ||
| Follow the steps below to develop and contribute to the project. | ||
|
|
||
| ## Requirements | ||
| * Python 3.8 or higher | ||
| * [Task] 3.38.0 or higher | ||
|
|
||
| ## Set up | ||
| Initialize and update submodules: | ||
| ```shell | ||
| git submodule update --init --recursive | ||
| ``` | ||
|
|
||
| ## Linting | ||
| Before submitting a pull request, ensure you’ve run the linting commands below and either fixed any | ||
| violations or suppressed the warning. | ||
|
|
||
| To run all linting checks: | ||
| ```shell | ||
| task lint:check | ||
| ``` | ||
|
|
||
| To run all linting checks AND automatically fix any fixable issues: | ||
| ```shell | ||
| task lint:fix | ||
| ``` | ||
|
|
||
| ### Running specific linters | ||
| The commands above run all linting checks, but for performance you may want to run a subset (e.g., | ||
| if you only changed C++ files, you don't need to run the YAML linting checks) using one of the tasks | ||
| in the table below. | ||
|
|
||
| | Task | Description | | ||
| |-------------------------|----------------------------------------------------------| | ||
| | `lint:yml-check` | Runs the YAML linters. | | ||
| | `lint:yml-fix` | Runs the YAML linters and fixes some violations. | | ||
|
|
||
| [Task]: https://taskfile.dev |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| version: "3" | ||
|
|
||
| includes: | ||
| lint: "lint-tasks.yml" | ||
| utils: "tools/yscope-dev-utils/taskfiles/utils.yml" | ||
|
|
||
| vars: | ||
| G_BUILD_DIR: "{{.ROOT_DIR}}/build" | ||
|
|
||
| tasks: | ||
| clean: | ||
| cmds: | ||
| - "rm -rf '{{.G_BUILD_DIR}}'" | ||
|
|
||
| init: | ||
| internal: true | ||
| silent: true | ||
| run: "once" | ||
| cmds: ["mkdir -p '{{.G_BUILD_DIR}}'"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| yamllint>=1.35.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| version: "3" | ||
|
|
||
| vars: | ||
| G_LINT_VENV_DIR: "{{.G_BUILD_DIR}}/lint-venv" | ||
|
|
||
| tasks: | ||
| check: | ||
| cmds: | ||
| - task: "yml-check" | ||
|
|
||
| fix: | ||
| cmds: | ||
| - task: "yml-fix" | ||
|
Comment on lines
+7
to
+13
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Tasks Looking at the lint-tasks.yml file, I can now verify that:
Note: The tasks appear to perform the same operation without any distinction between check and fix modes, which might be worth reviewing as the README suggests different behaviours:
🔗 Analysis chainVerify yml-check and yml-fix task definitions The tasks reference Let me try a different search strategy to locate these task definitions. Let's examine the Taskfile.yml and README.md to find the task definitions. Let's check the content of lint-tasks.yml since it's included in Taskfile.yml under the 'lint' namespace. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for yml-check and yml-fix task definitions
rg -l 'yml-(check|fix):' .
Length of output: 98 Script: #!/bin/bash
# Search for yml-check and yml-fix task definitions using broader patterns
rg -l "yml.*check|yml.*fix" .
# Also search for Taskfile or similar task definition files
fd -e yml -e yaml "Taskfile" .
Length of output: 106 Script: #!/bin/bash
# Check the content of Taskfile.yml and README.md
echo "=== Taskfile.yml ==="
cat Taskfile.yml
echo -e "\n=== README.md sections mentioning yml tasks ==="
rg -A 5 -B 5 "yml.*(check|fix)" README.md
Length of output: 1037 Script: #!/bin/bash
# Check the content of lint-tasks.yml
echo "=== lint-tasks.yml ==="
cat lint-tasks.yml
# Also check if there are any other task files in the tools directory
echo -e "\n=== Looking for additional task files ==="
fd -e yml -e yaml . tools/
Length of output: 1523 |
||
|
|
||
| yml: | ||
| aliases: | ||
| - "yml-check" | ||
| - "yml-fix" | ||
| deps: ["venv"] | ||
| cmds: | ||
| - |- | ||
| . "{{.G_LINT_VENV_DIR}}/bin/activate" | ||
| yamllint --strict . | ||
|
|
||
| venv: | ||
| internal: true | ||
| vars: | ||
| CHECKSUM_FILE: "{{.G_BUILD_DIR}}/{{.TASK | replace \":\" \"#\"}}.md5" | ||
| OUTPUT_DIR: "{{.G_LINT_VENV_DIR}}" | ||
| sources: | ||
| - "{{.ROOT_DIR}}/Taskfile.yml" | ||
| - "{{.TASKFILE}}" | ||
| - "lint-requirements.txt" | ||
| generates: ["{{.CHECKSUM_FILE}}"] | ||
| deps: | ||
| - ":init" | ||
| - task: ":utils:validate-checksum" | ||
| vars: | ||
| CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" | ||
| DATA_DIR: "{{.OUTPUT_DIR}}" | ||
| cmds: | ||
| - task: ":utils:create-venv" | ||
| vars: | ||
| LABEL: "lint" | ||
| OUTPUT_DIR: "{{.OUTPUT_DIR}}" | ||
| REQUIREMENTS_FILE: "lint-requirements.txt" | ||
| # This command must be last | ||
| - task: ":utils:compute-checksum" | ||
| vars: | ||
| DATA_DIR: "{{.OUTPUT_DIR}}" | ||
| OUTPUT_FILE: "{{.CHECKSUM_FILE}}" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Initialize and update the yscope-dev-utils submodule
The verification shows that
yscope-dev-utilsis a Git submodule that hasn't been initialized yet (indicated by the leading-in the submodule status). This explains why the utils.yml file is missing. The submodule needs to be initialized and updated before the taskfile can be used.lint-tasks.ymlexists and is properly referencedtools/yscope-dev-utilssubmodule is present but needs initializationgit submodule update --init tools/yscope-dev-utilsto makeutils.ymlavailable🔗 Analysis chain
Verify the existence of included task files.
The includes section references two external files. Let's verify their existence.
Let me verify if the utils file might be in a different location or if there are any similar YAML files that could help us understand the structure better.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 490
Script:
Length of output: 411