-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add linter configs to the os sync task #26
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
Conversation
WalkthroughThis change updates the Possibly related PRs
✨ Finishing Touches🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
Documentation and Community
|
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: 1
🧹 Nitpick comments (3)
lib/os-modules/Taskfile.yaml (2)
5-5
: Simplify DEFAULT_MODULES definitionSince there’s only one default module, you can replace the multiline block with a single-line string to improve readability:
- DEFAULT_MODULES: | - terraform-googleworkspace-users-groups-automation + DEFAULT_MODULES: terraform-googleworkspace-users-groups-automation
32-35
: Add existence check before syncingTo avoid rsync failures when a file is missing in the template, insert a pre-sync guard:
if [ ! -e "{{.SHARED_TMP_DIR}}/$file" ]; then echo "⚠️ Skipping missing $file" continue fiThis makes the sync task more robust.
.gitignore (1)
3-5
: Fix typos and improve ignore patternThere are minor spelling mistakes and the directory ignore can be simplified:
- # Claude Code - we beleive engineers are responsible for the code they push no matter how it's generated. + # Claude Code - we believe engineers are responsible for the code they push no matter how it's generated. - # Therefore, configs specific to their coding practices are their responsibilty to judiciously manage. + # Therefore, configs specific to their coding practices are their responsibility to judiciously manage. - .claude/* + .claude/This ensures the
.claude
folder itself is ignored and the comments read clearly.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.gitignore
(1 hunks)lib/os-modules/Taskfile.yaml
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.yaml`: You are well-versed in writing and reviewing YAML configurations for the Task tool (https://taskfile.dev/). Provide recommendations for clarity, maintainability, and a...
**/*.yaml
: You are well-versed in writing and reviewing YAML configurations for the Task tool (https://taskfile.dev/).
Provide recommendations for clarity, maintainability, and adherence to Taskfile best practices, including usage of variables, environment blocks, and includes.
These configurations may also contain embedded Bash scripts or commands.
Demonstrate bash scripting best practices such as error handling, secure variable expansions, and clear documentation.
lib/os-modules/Taskfile.yaml
cmds: | ||
- | | ||
# Convert newlines to spaces and remove backslashes | ||
modules=$(echo "{{.MODULES}}" | tr '\n' ' ' | sed 's/\\//g') | ||
for module in $modules | ||
do | ||
echo "Syncing files to ../$module..." | ||
echo "Syncing files to ../$module ..." |
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
Harden the sync script with strict error handling
Add set -euo pipefail
at the top of the sync
task’s inline script so that any error aborts the task immediately:
cmds:
- - |
+ - |
+ set -euo pipefail
# Convert newlines to spaces and remove backslashes
modules=$(echo "{{.MODULES}}" | tr '\n' ' ' | sed 's/\\//g')
📝 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.
echo "Syncing files to ../$module ..." | |
cmds: | |
- | | |
set -euo pipefail | |
# Convert newlines to spaces and remove backslashes | |
modules=$(echo "{{.MODULES}}" | tr '\n' ' ' | sed 's/\\//g') |
🤖 Prompt for AI Agents
In lib/os-modules/Taskfile.yaml at line 42, the sync task's inline script lacks
strict error handling. Add the line `set -euo pipefail` at the very beginning of
the script to ensure the task aborts immediately on any error, undefined
variable, or failed pipeline command.
@@ -5,8 +5,8 @@ vars: | |||
terraform-aws-ssm-agent \ | |||
terraform-aws-tailscale \ | |||
terraform-datadog-users \ | |||
terraform-github-teams \ |
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.
ordering modules in a-z order
@@ -32,12 +32,16 @@ tasks: | |||
vars: | |||
MODULES: "{{if .CLI_ARGS}}{{.CLI_ARGS}}{{else}}{{.DEFAULT_MODULES}}{{end}}" | |||
FILES: >- | |||
.github | |||
.trunk | |||
.checkov.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.
added and ordering a-z
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.
-- Thanks Weston!
what
Summary by CodeRabbit