Skip to content

ci: add SonarQube Cloud static analysis and coverage tracking#52

Merged
wolpert merged 1 commit into
mainfrom
ci/sonarqube-cloud
Jun 11, 2026
Merged

ci: add SonarQube Cloud static analysis and coverage tracking#52
wolpert merged 1 commit into
mainfrom
ci/sonarqube-cloud

Conversation

@wolpert

@wolpert wolpert commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What

Wires the project into SonarQube Cloud (free open-source tier) for coverage trends, code smells, security hotspots, and duplication tracking — complementing the existing per-module JaCoCo floors and Stryker mutation testing.

Changes

  • gradle/libs.versions.toml — add the org.sonarqube plugin (7.3.1.8318) to the version catalog.
  • build.gradle.kts (root) — apply the plugin and add a sonar { } block (project key codeheadsystems_pk-auth, org codeheadsystems, host sonarcloud.io, excluding examples/** and the generated browser SDK dist/). Coverage is auto-detected from the JaCoCo XML already produced by pkauth.test-conventions — no new plumbing.
  • .github/workflows/ci.yml — new sonar job running ./gradlew build jacocoTestReport sonar --no-configuration-cache, with fetch-depth: 0 and a fork-PR guard (forks can't read SONAR_TOKEN).
  • docs/adr/0017-... — ADR documenting the decision, options considered, and consequences.
  • README.md — Quality Gate + Coverage badges.

Notes

  • The sonar task is not Gradle configuration-cache compatible (the config cache is on globally), so CI invokes it with --no-configuration-cache — a scoped exception, documented in the ADR.
  • Prework (Sonar org/project import, Automatic Analysis disabled, SONAR_TOKEN repo secret) is already done. If the imported project key differs from codeheadsystems_pk-auth, update the two property(...) lines in build.gradle.kts and the badge URLs.
  • Verified locally that the plugin resolves and the :sonar task registers.

🤖 Generated with Claude Code

Apply the org.sonarqube Gradle plugin at the root for multi-module
aggregation, consuming the per-module JaCoCo XML already produced by
pkauth.test-conventions. A dedicated `sonar` CI job runs the build and
submits coverage + analysis, gated to pushes and same-repo PRs (fork
PRs can't read SONAR_TOKEN) with fetch-depth: 0 for SCM blame. The
sonar task is not configuration-cache compatible, so CI invokes it with
--no-configuration-cache (the config cache stays on globally).

Adds ADR 0017 documenting the decision and Quality Gate + Coverage
badges to the README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wolpert
wolpert enabled auto-merge (rebase) June 11, 2026 13:58
@wolpert
wolpert merged commit 0a78e32 into main Jun 11, 2026
5 checks passed
@wolpert
wolpert deleted the ci/sonarqube-cloud branch June 11, 2026 14:00
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

1 participant