-
Notifications
You must be signed in to change notification settings - Fork 2
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
chore: Add Taskfile tasks to lint YAML files. #4
Conversation
Caution Review failedThe pull request is closed. WalkthroughThis pull request introduces several changes across multiple files. The Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (7)
- .gitignore (1 hunks)
- .gitmodules (1 hunks)
- README.md (1 hunks)
- lint-requirements.txt (1 hunks)
- lint-tasks.yaml (1 hunks)
- taskfile.yaml (1 hunks)
- tools/yscope-dev-utils (1 hunks)
✅ Files skipped from review due to trivial changes (4)
- .gitignore
- .gitmodules
- lint-requirements.txt
- tools/yscope-dev-utils
🧰 Additional context used
🪛 LanguageTool
README.md
[style] ~33-~33: Consider using a different verb for a more formal wording.
Context: ...un all linting checks AND automatically fix any fixable issues: ```shell task lint:...
(FIX_RESOLVE)
🔇 Additional comments (6)
taskfile.yaml (2)
7-9
: LGTM! Well-structured variable definition.
The variable definition follows proper conventions with:
- Clear global variable naming (G_ prefix)
- Proper templating syntax
- Safe path handling with quotes
15-19
: LGTM! Well-configured initialization task.
The init task is properly configured with:
- Appropriate internal and silent flags
- Single-run configuration
- Safe directory creation using -p flag
lint-tasks.yaml (4)
31-58
: Well-structured virtual environment management
The venv task implementation is robust with:
- Proper isolation using
internal: true
- Efficient caching using checksums
- Clear dependency management
- Good variable usage for configuration
25-25
: Verify yamllint config file location
The yamllint configuration path assumes the submodule is present at a specific location.
Let's verify the config file exists:
#!/bin/bash
# Description: Check if yamllint config exists
test -f tools/yscope-dev-utils/lint-configs/.yamllint.yml && echo "Config exists" || echo "Config missing"
1-5
: Verify G_BUILD_DIR variable definition
The tasks rely on G_BUILD_DIR
which should be defined in a parent Taskfile.
Let's verify the variable definition:
8-15
: Verify yml-check and yml-fix task definitions
The check
and fix
tasks reference yml-check
and yml-fix
tasks that aren't defined in this file.
Let's verify these task definitions:
✅ Verification successful
Let me try a different search strategy to locate these task definitions.
Let me check the content of both yaml files to understand the task definitions.
Task references are correctly defined through aliases
The yml-check
and yml-fix
tasks are actually aliases of the yml
task defined in the same file. The yml
task is properly defined with the necessary dependencies and commands for YAML linting. The task structure is valid and will work as expected.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for yml-check and yml-fix task definitions
rg -l 'yml-(check|fix):' --type yaml
Length of output: 98
Script:
#!/bin/bash
# Search for task definitions in Taskfiles
fd "Taskfile" --type f --exec rg -l "yml-|yaml" {}
Length of output: 52
Script:
#!/bin/bash
# Search for any yaml/yml related task definitions
rg -l "task:.*ya?ml" --type yaml
Length of output: 50
Script:
#!/bin/bash
# List all yaml files to understand the task structure
fd -e yml -e yaml
Length of output: 49
Script:
#!/bin/bash
# Display content of both yaml files
echo "=== lint-tasks.yaml ==="
cat lint-tasks.yaml
echo -e "\n=== taskfile.yaml ==="
cat taskfile.yaml
Length of output: 1838
clean: | ||
cmds: | ||
- "rm -rf '{{.G_BUILD_DIR}}'" | ||
|
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.
🛠️ Refactor suggestion
Consider adding a precondition check to the clean task.
While the clean task is well-implemented, it could benefit from a precondition to verify the directory exists before attempting removal.
Consider this safer implementation:
clean:
cmds:
- - "rm -rf '{{.G_BUILD_DIR}}'"
+ - |
+ if [ -d "{{.G_BUILD_DIR}}" ]; then
+ rm -rf "{{.G_BUILD_DIR}}"
+ else
+ echo "Directory {{.G_BUILD_DIR}} does not exist. Nothing to clean."
+ fi
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
clean: | |
cmds: | |
- "rm -rf '{{.G_BUILD_DIR}}'" | |
clean: | |
cmds: | |
- | | |
if [ -d "{{.G_BUILD_DIR}}" ]; then | |
rm -rf "{{.G_BUILD_DIR}}" | |
else | |
echo "Directory {{.G_BUILD_DIR}} does not exist. Nothing to clean." | |
fi | |
version: "3" | ||
|
||
includes: | ||
lint: "lint-tasks.yaml" | ||
utils: "tools/yscope-dev-utils/taskfiles/utils.yml" | ||
|
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
Fix missing utility task file and standardize YAML file extensions
The verification revealed:
lint-tasks.yaml
exists and is correctly referencedtools/yscope-dev-utils/taskfiles/utils.yml
is missing- Inconsistent YAML extensions in the project (both
.yaml
and.yml
are used)
Please:
- Ensure the
yscope-dev-utils
submodule is properly initialized and updated - Consider standardizing to
.yaml
extension for consistency with existing files
🔗 Analysis chain
Verify the included task file paths and standardize file extensions.
The file paths need verification, and there's an inconsistency in the YAML file extensions (.yaml vs .yml).
Let's verify the file paths and check for consistency:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the existence of included task files and check for YAML extension consistency
echo "Checking for included task files..."
for file in lint-tasks.yaml tools/yscope-dev-utils/taskfiles/utils.yml; do
if [ -f "$file" ]; then
echo "✓ Found: $file"
else
echo "✗ Missing: $file"
fi
done
echo -e "\nChecking YAML file extension consistency..."
fd -e yml -e yaml . -x echo "Found YAML file: {}"
Length of output: 710
yml: | ||
aliases: | ||
- "yml-check" | ||
- "yml-fix" | ||
deps: ["venv"] | ||
cmds: | ||
- |- | ||
. "{{.G_LINT_VENV_DIR}}/bin/activate" | ||
yamllint \ | ||
--config-file "tools/yscope-dev-utils/lint-configs/.yamllint.yml" \ | ||
--strict \ | ||
.github/ \ | ||
lint-tasks.yaml \ | ||
taskfile.yaml | ||
|
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.
🛠️ Refactor suggestion
Consider making YAML paths configurable
The list of YAML files to lint is hardcoded. Consider moving these paths to variables for better maintainability.
Here's a suggested improvement:
- .github/ \
- lint-tasks.yaml \
- taskfile.yaml
+ {{.YAML_PATHS}}
Add to the vars section:
vars:
YAML_PATHS: .github/ lint-tasks.yaml taskfile.yaml
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.
I looked through the code, and looks very similar to clp-ffi-js. I did not test myself given urgency. I would consider adding the github workflow from clp-ffi-js, but am also happy to just do that in another PR.
Co-authored-by: davemarco <[email protected]>
Description
NOTE: The files in this PR (README.md, lint-requirements.txt, lint-tasks.yaml, taskfile.yaml) are mostly a copy of those in clp-ffi-js.
Validation performed
task lint:check
validated the existing YAML files.task lint:fix
did the same.task lint:yml
did the same.task lint:yml-check
did the same.task lint:yml-fix
did the same.task clean
cleaned any generated output.Summary by CodeRabbit
Summary by CodeRabbit
New Features
Documentation
Chores
.gitignore
to exclude build-related files.