Repository navigation
feat: implement issue #370 — SonarCloud: shell script hygiene cleanup (×20) - #374
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 7 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors conditional statements across several shell scripts to use double brackets [[ ... ]] instead of single brackets [ for more robust Bash evaluations. The review feedback suggests removing a redundant return 0 statement in the assert_contains function and combining separate double-bracket checks into a single [[ ... ]] expression using the && operator.
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #370 by applying mechanical SonarCloud hygiene fixes across the repository’s bash scripts and their test, primarily replacing legacy [ conditionals with bash’s safer [[ construct and adding an explicit return in the test helper function to satisfy the cited rule set. The changes align with the repo’s existing bash usage (#!/usr/bin/env bash, set -euo pipefail) and are intended to be behavior-preserving.
Changes:
- Replace
if [ ... ]/ chained[tests withif [[ ... ]]across the targeted scripts/tests. - Add an explicit
return 0at the end ofassert_contains()in the shell test to satisfy the “explicit return at end of function” finding. - Keep existing safety guards and dry-run logic intact while improving conditional hygiene.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/scripts/apply-repo-settings.test.sh |
Updates conditionals to [[ ... ]] and adds an explicit return 0 in the assertion helper. |
scripts/apply-rulesets.sh |
Converts relevant conditionals to [[ ... ]] while preserving token guard and repo-identity safety check behavior. |
scripts/apply-repo-settings.sh |
Converts relevant conditionals to [[ ... ]] in token guard, safety check, and dry-run branches. |
Dev-Lead — review-changes (applied)Changes committed and pushed. |
|
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: LOW
Reviewed commit: 234e02e2194cff559e55d1686b2046701e29fc69
Review mode: triage-approved (single reviewer)
Summary
Mechanical shell hygiene cleanup for issue #370: converts POSIX [ ... ] tests to Bash [[ ... ]] across scripts/apply-repo-settings.sh (7), scripts/apply-rulesets.sh (8), and tests/scripts/apply-repo-settings.test.sh (4). All conversions are semantically equivalent (string equality, -z/-n, -gt, file tests); no logic, quoting, or control-flow changes. Verified no single-bracket tests remain in the touched scripts at head.
Linked issue analysis
Issue #370 lists 20 SonarCloud findings: 19× S7688 (use [[) and 1× S7682 (explicit return in function). All 19 S7688 findings are resolved. The S7682 fix (return 0 at end of assert_contains) was initially added, then removed in commit 234e02e per the repo owner's review instruction (Gemini flagged it redundant; both review threads are resolved and outdated). Net effect: 19/20 findings fixed; S7682 may remain open in SonarCloud, but this was a deliberate owner decision, not an oversight — non-blocking. Behavior-preservation and green-CI acceptance criteria are met.
Findings
- No security, correctness, or maintainability issues found. The touched scripts are repo-admin tooling (settings/rulesets), but all changes are syntax-only and behavior-preserving; safety guards (GH_TOKEN check, repo-identity check, dry-run gating) are intact.
- Note (non-blocking): SonarCloud finding S7682 (explicit return in
assert_contains) will likely remain open post-merge since thereturn 0was removed at the owner's direction. If it resurfaces, an inline# NOSONARor accepting the finding is the follow-up. - Secret scan: the run_secret_scanning MCP tool is not available in this environment; relied on the green gitleaks CI check (passed). No secret-like content in the diff.
CI status
All checks green: CI (TypeScript, Go, gitleaks) ✓, CodeQL (actions/go/js-ts) ✓, SonarCloud quality gate passed (0 new issues, 0 hotspots) ✓, AgentShield ✓, dependency-audit ✓. Remaining checks skipped by design (dependabot, image push, ci-relay).
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: LOW
Reviewed commit: 234e02e2194cff559e55d1686b2046701e29fc69
Review mode: triage-approved (single reviewer)
Summary
Mechanical shell hygiene cleanup for issue #370: converts 19 POSIX [ ... ] tests to Bash [[ ... ]] across scripts/apply-repo-settings.sh (7), scripts/apply-rulesets.sh (8), and tests/scripts/apply-repo-settings.test.sh (4, two merged into one [[ ... && ... ]]). All conversions are semantically equivalent; no logic, quoting, or control-flow changes. Triage assessment (low-risk) confirmed.
Linked issue analysis
Issue #370 lists 20 SonarCloud findings: 19x S7688 (use [[) and 1x S7682 (explicit return). All 19 S7688 findings are resolved. The S7682 fix (return 0 in assert_contains) was added in the first commit, then removed in 234e02e per the repo owner's review-changes instruction after Gemini flagged it redundant; both review threads are resolved. Net: 19/20 findings fixed, with the remaining one a deliberate owner decision — non-blocking. Behavior-preservation and green-CI acceptance criteria are met.
Findings
- No security, correctness, or maintainability issues. The touched scripts are repo-admin tooling (settings/rulesets), but every change is syntax-only and behavior-preserving; safety guards (GH_TOKEN check, repo-identity check, duplicate-ruleset guard, dry-run gating) are intact.
- The combined test [[ ! -x "$SCRIPT" && ! -f "$SCRIPT" ]] is logically identical to the prior chained [ ] && [ ] form.
- Note (non-blocking): SonarCloud S7682 may remain open post-merge since the return 0 was removed at the owner's direction; if it resurfaces, accept the finding or add an inline NOSONAR.
- Secret scan: the run_secret_scanning MCP tool is not available in this environment; relied on the green gitleaks CI check. No secret-like content in the diff.
CI status
All checks green: CI (TypeScript, Go, gitleaks) passed, CodeQL (actions/go/js-ts) passed, SonarCloud quality gate passed (0 new issues, 0 hotspots), AgentShield passed, dependency-audit passed. Remaining checks skipped by design (dependabot-automerge, image push, ci-relay, unused ecosystem audits).
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.



Closes #370
Implemented by dev-lead agent. Please review.