Skip to content

feat: implement issue #370 — SonarCloud: shell script hygiene cleanup (×20) - #374

Merged
don-petry merged 2 commits into
mainfrom
dev-lead/issue-370-20260703-2128
Jul 3, 2026
Merged

don-petry merged 2 commits into
mainfrom
dev-lead/issue-370-20260703-2128

Conversation

@don-petry

Copy link
Copy Markdown
Contributor

Closes #370

Implemented by dev-lead agent. Please review.

Copilot AI review requested due to automatic review settings July 3, 2026 21:31
@don-petry
don-petry requested a review from a team as a code owner July 3, 2026 21:31
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@don-petry, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9d8d5b93-a581-4b8c-9911-e39bd41fa19c

📥 Commits

Reviewing files that changed from the base of the PR and between 71c3ba0 and 234e02e.

📒 Files selected for processing (3)
  • scripts/apply-repo-settings.sh
  • scripts/apply-rulesets.sh
  • tests/scripts/apply-repo-settings.test.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-370-20260703-2128

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 with if [[ ... ]] across the targeted scripts/tests.
  • Add an explicit return 0 at the end of assert_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.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) July 3, 2026 21:37
@don-petry
don-petry disabled auto-merge July 3, 2026 21:39
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) July 3, 2026 21:40

@donpetry-bot donpetry-bot left a comment

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.

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 the return 0 was removed at the owner's direction. If it resurfaces, an inline # NOSONAR or 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.

@don-petry
don-petry merged commit 350e0a4 into main Jul 3, 2026
24 checks passed
@don-petry
don-petry deleted the dev-lead/issue-370-20260703-2128 branch July 3, 2026 21:47

@donpetry-bot donpetry-bot left a comment

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SonarCloud: shell script hygiene cleanup (×20)

3 participants