Skip to content

Broaden sonarCoverageExclusions to a full sonarExclusions - #72

Open
gpunto wants to merge 1 commit into
developfrom
broaden-sonar-exclusions
Open

Broaden sonarCoverageExclusions to a full sonarExclusions#72
gpunto wants to merge 1 commit into
developfrom
broaden-sonar-exclusions

Conversation

@gpunto

@gpunto gpunto commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Goal

Closes AND-1362

coverage.sonarCoverageExclusions only mapped to sonar.coverage.exclusions, which silences coverage but not duplication. Generated OpenAPI network models are near-identical by design and trip SonarCloud's duplication gate, and a coverage-only exclusion cannot silence that.

Implementation

  • Rename CoverageOptions.sonarCoverageExclusions to sonarExclusions.
  • Wire it to sonar.exclusions (full) instead of sonar.coverage.exclusions, so matched paths drop from coverage, duplication, and issues. This is the path-based analogue of skipping a whole module.
  • Update README DSL example.

Breaking: consumers using the old property name must rename it. Full exclusion also drops matched paths from issue analysis, not just coverage.

Testing

Sonar analysis should exclude the configured paths from all metrics (coverage, duplication, issues).

Summary by CodeRabbit

  • New Features

    • Added unified Sonar exclusions for coverage, duplication, and issue analysis.
    • Renamed the exclusion setting to sonarExclusions for clearer configuration.
  • Documentation

    • Updated configuration guidance to reflect the unified Sonar exclusions setting.

Rename the CoverageOptions property to sonarExclusions and wire it to
sonar.exclusions instead of sonar.coverage.exclusions, so matched paths
are excluded from all Sonar analysis (coverage, duplication, issues).
This is the path-based analogue of skipping a whole module, and lets
generated code (e.g. near-identical OpenAPI network models) be excluded
from the duplication gate while staying internal.
@gpunto gpunto added the pr:gradle-plugins The PR includes changes to the Gradle Plugins published by this repo label Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@gpunto gpunto changed the title Broaden coverage.sonarCoverageExclusions to a full sonarExclusions Broaden sonarCoverageExclusions to a full sonarExclusions Jul 31, 2026
@gpunto
gpunto marked this pull request as ready for review August 3, 2026 07:57
@gpunto
gpunto requested a review from a team August 3, 2026 07:57
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The plugin renames sonarCoverageExclusions to sonarExclusions and maps the option to sonar.exclusions. The README now documents exclusions for coverage, duplication, and issue analysis.

Changes

Unified Sonar exclusions

Layer / File(s) Summary
Configure unified Sonar exclusions
plugin/src/main/kotlin/io/getstream/android/coverage/CoverageOptions.kt, plugin/src/main/kotlin/io/getstream/android/coverage/CoverageConfiguration.kt, README.md
CoverageOptions exposes sonarExclusions. The plugin reads this property and assigns it to sonar.exclusions. The README documents the updated setting.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Poem

A rabbit hops through Sonar’s gate,
With exclusions gathered neat and straight.
Coverage, issues, copies too,
One setting tells them what to do.
“Hop hop!” the README sings,
As cleaner paths bring tidier things.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change from coverage-only exclusions to full Sonar exclusions.
Description check ✅ Passed The description covers the goal, implementation, breaking change, and testing intent, but omits the required checklist.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch broaden-sonar-exclusions

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.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
README.md (1)

51-53: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Clarify that the exclusion applies to source files.

Sonar defines sonar.exclusions for source files, while test files use sonar.test.exclusions. The phrase “excluded from all analysis” can mislead consumers who expect test files to be excluded too. (docs.sonarsource.com)

Suggested wording
-        // Additional Sonar exclusion patterns for file paths, excluded from all analysis
-        // (coverage, duplication, issues) (default: empty)
+        // Additional Sonar source-file exclusion patterns for coverage, duplication,
+        // and issue analysis (default: empty)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 51 - 53, Update the README comment above
sonarExclusions to state that these patterns exclude source files from Sonar
analysis, not test files; preserve the existing configuration and clarify that
test exclusions use sonar.test.exclusions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@README.md`:
- Around line 51-53: Update the README comment above sonarExclusions to state
that these patterns exclude source files from Sonar analysis, not test files;
preserve the existing configuration and clarify that test exclusions use
sonar.test.exclusions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 12370744-8f50-479f-bf90-37b453561635

📥 Commits

Reviewing files that changed from the base of the PR and between ec1d49b and 35c7413.

📒 Files selected for processing (3)
  • README.md
  • plugin/src/main/kotlin/io/getstream/android/coverage/CoverageConfiguration.kt
  • plugin/src/main/kotlin/io/getstream/android/coverage/CoverageOptions.kt

@gpunto
gpunto enabled auto-merge (squash) August 7, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:gradle-plugins The PR includes changes to the Gradle Plugins published by this repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant