SonarCloud analysis
CI runs a SonarCloud Analysis job that uploads Go coverage and static-analysis results to sonarcloud.io. The job is opt-in: it skips gracefully when the repository doesn’t have a SONAR_TOKEN secret configured, so the rest of CI stays green until you finish provisioning.
One-time setup
Section titled “One-time setup”- Sign in to sonarcloud.io with the GitHub org account that owns this repository.
- From the
altairalabsorganization dashboard, Import a new project → pickCodeGen-Sandbox.- Project key:
AltairaLabs_CodeGen-Sandbox(matchessonar.projectKeyinsonar-project.properties) - Organization:
altairalabs(matchessonar.organization)
- Project key:
- Under Administration → Analysis Method, pick “With GitHub Actions”. SonarCloud will show a
SONAR_TOKENvalue — copy it. - In the GitHub repo, Settings → Secrets and variables → Actions → New repository secret:
- Name:
SONAR_TOKEN - Value: (the token from step 3)
- Name:
- Push any commit (or re-run the latest CI). The
SonarCloud Analysisjob will now actually run the scan.
What gets analysed
Section titled “What gets analysed”sonar-project.properties at the repo root is the source of truth. In summary:
- Sources:
cmd/,internal/ - Tests:
**/*_test.go - Excluded:
docs/(Astro content),bin/,vendor/, generated code - Coverage: uploaded as
coverage.outfrom theGo test + lint + buildjob (generated viago test -race -coverprofile=coverage.out -covermode=atomic) - Coverage exclusions: a small list of entry-point / wiring files that don’t lend themselves to unit tests (see the properties file for the current list with rationale)
Quality gate
Section titled “Quality gate”SonarCloud’s default “Sonar way” quality gate is enforced by the SonarSource/sonarqube-quality-gate-action. A failure becomes a failed check on the PR with a summary comment. Tune the gate in SonarCloud’s UI; no changes needed in this repo.
Disabling
Section titled “Disabling”If the organisation’s posture changes and SonarCloud is no longer wanted:
- Delete the
SONAR_TOKENsecret — the job reverts to its no-op state and CI stays green. - (Optional) remove the
sonarcloudjob from.github/workflows/ci.ymland dropsonar-project.properties.