-
Notifications
You must be signed in to change notification settings - Fork 44
Add shell syntax checker to CI and Fish completion documentation #41
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 pull request adds a shell syntax checker to the CI configuration pipeline and appends user guidance to the setup script for enabling Fish shell completions. Two straightforward additions: automated shell linting rules and documentation about Fish symlink setup. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes
Poem
Pre-merge checks and finishing touchesCaution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
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
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.coderabbit.yaml(1 hunks)templates/setup-example.sh(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.sh
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.sh: Always quote paths to handle spaces and special characters; avoid unguarded globbing
Keepset -eactive in shell scripts; ensure non-critical failures are guarded withcommand || true
**/*.sh: Use shebang#!/usr/bin/env bash(not/bin/bashor/bin/sh)
Usesnake_casenaming for functions
Usesnake_casefor local variables andUPPER_CASEfor constants/environment variables
Use 2-space indentation (no tabs)
Always quote variables and paths to handle spaces and special characters
Check return codes and use|| exit 1or|| return 1for error handling
Uselocalfor function-scoped variables to avoid polluting global namespace
Target Bash 3.2+ compatibility in shell scripts
Files:
templates/setup-example.sh
**/*.{bash,fish,sh}
📄 CodeRabbit inference engine (.github/instructions/sh.instructions.md)
**/*.{bash,fish,sh}: Bash 3.2+ compatible (macOS default), but 4.0+ features allowed where appropriate
Always quote variables: use"$var"not$var
Use function-scoped variables:local var="value"
Check return codes; functions return 1 on failure
Usesnake_casefor functions and variables,UPPER_CASEfor constants
Prefer[ ]over[[ ]]for POSIX portability; use[[only when needed
Always quote glob inputs; disable unintended globbing withset -ftemporarily if required
Avoid associative arrays in shell scripts; use simple string/loop constructs for Bash 3.2+ compatibility
Avoidreadarrayand process substitution unsupported in older Bash
Debug withbash -x ./bin/gtr <cmd>or wrap suspicious blocks withset -x/set +x
Check function presence withdeclare -f create_worktreeordeclare -f resolve_target
Use stderr for variable inspection:echo "DEBUG var=$var" >&2to keep stdout clean for command substitution
Keep dependencies minimal: only usegit,sed,awk,find,grep; avoid jq/curl unless justified
Check availability of external commands before use when adding new tools
Use"${var}"for variable expansion; for line loops usewhile IFS= read -r line; do ... doneto preserve spaces
Sanitize branch names viasanitize_branch_namefunction; do NOT duplicate logic elsewhere
Everything is sourced at startup withset -eenabled; functions call each other directly; no subshells except for hooks and AI tools
Files:
templates/setup-example.sh
🔇 Additional comments (1)
templates/setup-example.sh (1)
37-40: Verify thatcompletions/gtr.fishexists in the repository.The Fish shell completion guidance references a hardcoded placeholder path (
/path/to/git-worktree-runner/completions/gtr.fish). While placeholder paths are acceptable in example documentation for user customization, confirm that the actualgtr.fishfile exists in thecompletions/directory to ensure the instructions are actionable. If the file doesn't exist, either create it or update the documentation to reflect the current state.
| pre_merge_checks: | ||
| custom_checks: | ||
| - mode: error | ||
| name: shell-check | ||
| instructions: | | ||
| - Always check if the shell scripts are valid and sytactically correct. | ||
| - Make sure there are examples for all the supported shells, such as bash, zsh, fish, etc. |
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.
Fix typo in shell-check instructions.
Line 24 contains "sytactically" which should be "syntactically".
pre_merge_checks:
custom_checks:
- mode: error
name: shell-check
instructions: |
- - Always check if the shell scripts are valid and sytactically correct.
+ - Always check if the shell scripts are valid and syntactically correct.
- Make sure there are examples for all the supported shells, such as bash, zsh, fish, etc.📝 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.
| pre_merge_checks: | |
| custom_checks: | |
| - mode: error | |
| name: shell-check | |
| instructions: | | |
| - Always check if the shell scripts are valid and sytactically correct. | |
| - Make sure there are examples for all the supported shells, such as bash, zsh, fish, etc. | |
| pre_merge_checks: | |
| custom_checks: | |
| - mode: error | |
| name: shell-check | |
| instructions: | | |
| - Always check if the shell scripts are valid and syntactically correct. | |
| - Make sure there are examples for all the supported shells, such as bash, zsh, fish, etc. |
🤖 Prompt for AI Agents
In .coderabbit.yaml around lines 19 to 25, the custom_check instruction text has
a typo: replace "sytactically" with "syntactically" in the shell-check
instructions so the line reads "Always check if the shell scripts are valid and
syntactically correct." and keep the rest of the block unchanged.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.