Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
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
3 changes: 3 additions & 0 deletions .gitmodules
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
5 changes: 5 additions & 0 deletions .yamllint.yaml
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/
38 changes: 38 additions & 0 deletions README.md
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
19 changes: 19 additions & 0 deletions Taskfile.yml
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"
Comment on lines +3 to +5

Copy link
Copy Markdown
Contributor

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-utils is 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.

  • The local lint-tasks.yml exists and is properly referenced
  • The tools/yscope-dev-utils submodule is present but needs initialization
  • Run git submodule update --init tools/yscope-dev-utils to make utils.yml available
🔗 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:

#!/bin/bash
# Description: Verify that the referenced task files exist

echo "Checking for included task files..."
for file in "lint-tasks.yml" "tools/yscope-dev-utils/taskfiles/utils.yml"; do
  if [ -f "$file" ]; then
    echo "✓ Found: $file"
  else
    echo "✗ Missing: $file"
  fi
done

Length of output: 490


Script:

#!/bin/bash
# Search for utils.yml files and taskfiles directories
echo "Searching for utils.yml files:"
fd utils.yml

echo -e "\nSearching for taskfiles directories:"
fd taskfiles -t d

echo -e "\nChecking if yscope-dev-utils is a submodule:"
git submodule status | grep yscope-dev-utils

Length of output: 411


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}}'"]
1 change: 1 addition & 0 deletions lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yamllint>=1.35.1
51 changes: 51 additions & 0 deletions lint-tasks.yml
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Tasks yml-check and yml-fix are aliases for the same YAML linting operation

Looking at the lint-tasks.yml file, I can now verify that:

  • Both yml-check and yml-fix are defined as aliases under the yml task
  • They both execute the same yamllint command with strict configuration
  • The tasks are properly configured with virtual environment setup and dependencies

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:

  • lint:yml-check is documented to run linters
  • lint:yml-fix is documented to run linters and fix violations
🔗 Analysis chain

Verify yml-check and yml-fix task definitions

The tasks reference yml-check and yml-fix which aren't defined in this file.


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 executed

The 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}}"
1 change: 1 addition & 0 deletions tools/yscope-dev-utils
Submodule yscope-dev-utils added at 159768