Skip to content

feat(ci): add SonarCloud analysis for shell scripts and workflow templates#90

Merged
williaby merged 4 commits into
mainfrom
feat/sonarcloud-setup
May 14, 2026
Merged

feat(ci): add SonarCloud analysis for shell scripts and workflow templates#90
williaby merged 4 commits into
mainfrom
feat/sonarcloud-setup

Conversation

@williaby
Copy link
Copy Markdown
Collaborator

@williaby williaby commented May 14, 2026

Summary

  • Adds sonar-project.properties with project key ByronWilliamsCPA_.github
  • Adds .github/workflows/sonarcloud.yml that runs on push to main and pull requests
  • Uses sonarqube-scan-action@v8.0.0 (consistent with other callers in this repo)
  • sonar.sources=. scans shell scripts, YAML workflow templates, and configuration files; SonarCloud auto-detects languages

Why

Both ByronWilliamsCPA/.claude and ByronWilliamsCPA/.github are org-level control-plane repos that should have SonarCloud coverage. The project is already registered at sonarcloud.io and SONAR_TOKEN is available as an org-level secret.

Test plan

  • pre-commit run passes on both new files
  • Project ByronWilliamsCPA_.github registered at sonarcloud.io
  • SONAR_TOKEN available as org-level secret

Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Integrated automated code quality scanning via SonarCloud for continuous analysis on pushes and pull requests.

Review Change Stack

Copilot AI review requested due to automatic review settings May 14, 2026 15:36
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR adds SonarCloud code quality scanning infrastructure to the repository. It introduces a GitHub Actions workflow that triggers scans on pushes to main and pull requests, plus a configuration file that specifies which files to scan and which paths to exclude from analysis.

Changes

SonarCloud Code Quality Scanning Setup

Layer / File(s) Summary
SonarCloud workflow configuration
.github/workflows/sonarcloud.yml
GitHub Actions workflow with push/pull_request/manual triggers, scoped permissions, concurrency control with cancellation, runner hardening, full-history checkout, and SonarCloud scan action gated for same-repo PRs using GITHUB_TOKEN, SONAR_TOKEN, and SONAR_HOST_URL secrets.
SonarCloud project configuration
sonar-project.properties
SonarCloud project settings including identifiers (project key, organization, name), scan scope set to repository root, exclusion patterns for documentation/examples/markdown/text and license files, and UTF-8 source encoding.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related issues

Possibly related PRs

  • ByronWilliamsCPA/.github#36: Depends on this PR's SonarCloud workflow as the source for the sonarcloud-quality-gate check context that PR #36 explicitly references in its CI gate job.

Poem

🐰 A workflow springs to life so bright,
With SonarCloud to scan the night,
Each property set just right,
Code quality takes flight! ✨
Quality gates, forever tight,
The rabbit's code shines ever-white.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change—adding SonarCloud analysis for shell scripts and workflow templates—which directly aligns with the primary changes of adding sonar-project.properties and the sonarcloud.yml workflow.
Description check ✅ Passed The PR description is comprehensive, covering the summary of changes, rationale, and test plan. However, the author did not complete the formal template sections (Type of Change, Changes Made, Testing checklist, etc.) that align with the repository's template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sonarcloud-setup

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 and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

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 introduces SonarCloud scanning for the .github control-plane repository by adding a repository-level SonarCloud configuration and a dedicated GitHub Actions workflow to run analysis on pushes to main and on pull requests.

Changes:

  • Add sonar-project.properties to configure SonarCloud project/org and define sources/exclusions.
  • Add .github/workflows/sonarcloud.yml to run SonarCloud analysis (with pinned actions) on main pushes and PRs.
  • Update CHANGELOG.md (currently includes an entry unrelated to the changes in this PR).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
sonar-project.properties Adds SonarCloud project configuration, scan scope, and exclusions.
CHANGELOG.md Adds a new changelog bullet (does not match the PR’s actual changes).
.github/workflows/sonarcloud.yml Adds a workflow to execute SonarCloud scanning for this repo.

Comment thread CHANGELOG.md
- `python-scorecard.yml`: hard-code `publish_results: false` in the `ossf/scorecard-action` step and remove `id-token: write` from the workflow permissions; the OIDC token `repository` claim resolves to the `.github` org repo when the workflow runs as a reusable callee, causing scorecard-action to publish to the wrong repository and error; the `publish-results` input is retained for backwards compatibility but is now deprecated and always treated as false; SARIF upload to the Security tab is unaffected
- `scorecard.yml`: remove `publish-results: true` and `id-token: write` from the `.github` org repo's own scorecard caller to align with the reusable workflow fix
- `workflow-templates/python-scorecard.yml`: remove `id-token: write` from top-level and job-level permissions and remove `publish-results: true` from the `with:` block; aligns the starter template with the reusable workflow fix so new repos generated from this template get the correct permission set
- `python-compatibility.yml`: move `# shellcheck disable=SC1033,...` directives from YAML-level comments into the `run: |` block body for the Ubuntu and macOS system-deps steps; shellcheck only processes content inside the run block, so YAML-level disable comments were silently ignored, causing the self-test CI to fail on shellcheck SC1073/SC1033/SC1050/SC1072/SC1140
Comment thread sonar-project.properties Outdated
Comment on lines +42 to +48
- name: SonarCloud Scan
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
uses: SonarSource/sonarqube-scan-action@59db25f34e16620e48ab4bb9e4a5dce155cb5432 # v8.0.0 # nosemgrep: detected-sonarqube-docs-api-key
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
williaby and others added 4 commits May 14, 2026 08:50
…on-compatibility.yml

YAML-level comments are invisible to shellcheck; the disable directives
must be the first lines inside the run: | block to take effect. Fixes
the pre-existing self-test CI failure introduced when the actionlint
workflow was added in #77.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Shellcheck cannot parse bracket-class regex inline in [[ =~ ]] and reports
SC1073/SC1033/SC1050/SC1072/SC1140. Extracting the pattern into a variable
causes shellcheck to treat it as an opaque string and skip regex parsing.
Disable directives are no longer needed and are removed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lates

Adds sonar-project.properties and .github/workflows/sonarcloud.yml to bring
ByronWilliamsCPA/.github into alignment with ByronWilliamsCPA/.claude, both
of which should have SonarCloud coverage per org standards.

SonarCloud will auto-detect shell and YAML sources; no Python configuration
required. sonar.sources=. scans scripts/, workflow templates, and config.

SETUP REQUIRED before merging:
  1. Register ByronWilliamsCPA/.github at https://sonarcloud.io
  2. Generate a token at https://sonarcloud.io/account/security
  3. Add SONAR_TOKEN to repository secrets (Settings > Secrets > Actions)

The workflow will fail until SONAR_TOKEN is configured.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Project ByronWilliamsCPA_.github is already registered at sonarcloud.io
and SONAR_TOKEN is available as an org-level secret. No manual setup needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@williaby williaby force-pushed the feat/sonarcloud-setup branch from fc8cb8c to 78599c4 Compare May 14, 2026 15:51
@sonarqubecloud
Copy link
Copy Markdown

@williaby williaby merged commit 2174a6b into main May 14, 2026
26 of 27 checks passed
@williaby williaby deleted the feat/sonarcloud-setup branch May 14, 2026 16:16
williaby added a commit that referenced this pull request May 14, 2026
Updates the reusable workflow reference from b29a870 to 2174a6b
(feat(ci): add SonarCloud analysis for shell scripts and workflow
templates #90). Dependabot did not auto-update because the branch
was marked as edited; this commit restores parity with main.

All caller inputs verified compatible at new SHA.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants