Skip to content

Add SonarCloud integration#33

Merged
rammrain merged 3 commits into
mainfrom
task-2
Apr 10, 2026
Merged

Add SonarCloud integration#33
rammrain merged 3 commits into
mainfrom
task-2

Conversation

@rammrain
Copy link
Copy Markdown
Member

@rammrain rammrain commented Apr 10, 2026

Summary

  • Add org.sonarqube Gradle plugin (v7.2.3.7755) with SonarCloud properties (projectKey, organization, host.url, JaCoCo report path)
  • Create dedicated GitHub Actions workflow that runs test → jacocoTestReport → sonar on PRs and pushes to main
  • Wire jacocoTestReport to produce XML and run automatically after test
  • Add SonarCloud quality gate badge to README

Manual steps required after merge

  • Register the repository on SonarCloud under the bitweb_oss organization
  • Install the SonarCloud GitHub App on the BitWeb org (if not already installed)
  • Add SONAR_TOKEN as a repository secret (GitHub Settings → Secrets → Actions)
  • Verify PR decoration (inline comments, quality gate status check) is working

Closes #2

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Tests

    • Configured automated code coverage reporting, finalised on each test execution.
  • Chores

    • Integrated SonarCloud code quality analysis into the continuous integration pipeline.
    • Set up GitHub Actions workflow to run quality checks on pull requests and main branch pushes.
  • Documentation

    • Added SonarCloud quality status badge to the project README.

Configure the SonarQube Gradle plugin, add a dedicated GitHub Actions
workflow that runs analysis on PRs and pushes to main, wire JaCoCo XML
reports for coverage import, and add the quality gate badge to README.

Closes #2

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

Warning

Rate limit exceeded

@rammrain has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 41 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 41 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0d3dbd28-d204-4dfa-9273-0160f4ff1c02

📥 Commits

Reviewing files that changed from the base of the PR and between d2ce3a3 and ea030e9.

📒 Files selected for processing (2)
  • .github/workflows/sonarcloud.yml
  • build.gradle
📝 Walkthrough

Walkthrough

This pull request establishes SonarCloud static analysis integration by introducing the SonarQube Gradle plugin, configuring SonarCloud project metadata in the build configuration, creating a GitHub Actions workflow to execute analysis on pull requests and pushes to the main branch, and updating build task configuration to generate JaCoCo coverage reports automatically.

Changes

Cohort / File(s) Summary
CI/CD Workflow
.github/workflows/sonarcloud.yml
New GitHub Actions workflow that triggers on pull requests and pushes to main, executing tests, JaCoCo coverage reporting, and SonarCloud analysis using the configured SONAR_TOKEN secret.
Build & Coverage Configuration
build.gradle, test.gradle
Added org.sonarqube Gradle plugin with SonarCloud project configuration (key, organisation, host URL, and JaCoCo coverage report path). Updated test task to finalise with jacocoTestReport and enabled XML output for the coverage report.
Documentation
README.md
Added SonarCloud Quality Gate Status badge linking to the project's code summary page.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Initial project setup #5 — Shares modifications to Gradle build and test configuration files, particularly regarding JaCoCo coverage report task setup and CI workflow integration.

Poem

🐰 A bunny hops through code so clean,
SonarCloud's gaze now sees the scene,
With coverage reports in XML format bright,
Quality gates guard every pull request's flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add SonarCloud integration' directly and accurately summarises the primary change: integrating SonarCloud into the project.
Linked Issues check ✅ Passed The pull request implements all coding-related requirements from issue #2: adding org.sonarqube Gradle plugin, configuring SonarCloud properties, creating a GitHub Actions workflow, configuring JaCoCo XML reporting, and adding a quality gate badge to README.
Out of Scope Changes check ✅ Passed All code changes directly relate to SonarCloud integration objectives. No unrelated or out-of-scope modifications are present in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 task-2

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

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/sonarcloud.yml:
- Around line 3-6: The Sonar step is running unconditionally and fails for
forked pull_request events because SONAR_TOKEN isn't available; update the Sonar
job/step (the step invoking "sonar" and referencing SONAR_TOKEN) to include a
conditional like: run only when github.event_name == "push" OR when
github.event_name == "pull_request" AND
github.event.pull_request.head.repo.full_name == github.repository so Sonar only
executes for trusted contexts (pushes or PRs from the base repo) and avoid
attempting to use SONAR_TOKEN for external fork PRs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bae0b0e4-71d9-406a-9742-51a78919affc

📥 Commits

Reviewing files that changed from the base of the PR and between 20059d3 and d2ce3a3.

📒 Files selected for processing (4)
  • .github/workflows/sonarcloud.yml
  • README.md
  • build.gradle
  • test.gradle

Comment thread .github/workflows/sonarcloud.yml
SONAR_TOKEN is not available for pull_request events from forks.
Split the Gradle invocation so tests always run, but the sonar
analysis only runs in trusted contexts (pushes or same-repo PRs).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rammrain
Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rammrain rammrain merged commit e9e6092 into main Apr 10, 2026
6 of 7 checks passed
@rammrain rammrain deleted the task-2 branch April 10, 2026 08:43
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.

Add SonarCloud integration

1 participant