feat(sonarqube-backend): fetch hotspot count, debt and language distribution - #10299
Open
rios0rios0 wants to merge 1 commit into
Open
feat(sonarqube-backend): fetch hotspot count, debt and language distribution#10299rios0rios0 wants to merge 1 commit into
rios0rios0 wants to merge 1 commit into
Conversation
…ibution The metric list requests `security_hotspots_reviewed` and `sqale_rating` — the percentage of hotspots reviewed and the maintainability grade — but neither carries the underlying figure. Consumers that want to display a hotspot count or a technical debt duration cannot obtain them: the list is fixed and this plugin holds the only SonarQube credential, so they see whatever `getFindings` returns. Adds `security_hotspots`, `sqale_index` and `ncloc_language_distribution`. All three are standard metrics, and `metricsToQuery` already intersects the wanted list with `api/metrics/search`, so an instance that does not support one simply omits it. Signed-off-by: rios0rios0 <rios0rios0@outlook.com>
Contributor
Changed Packages
|
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the SonarQube backend plugin’s fixed metrics list used by getFindings so consumers can access underlying hotspot counts, technical debt duration, and language distribution directly from the backend-provided measures.
Changes:
- Add
security_hotspots,sqale_index, andncloc_language_distributionto thewantedMetricslist ingetFindings. - Add a changeset bumping
@backstage-community/plugin-sonarqube-backendasminordocumenting the new metrics.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| workspaces/sonarqube/plugins/sonarqube-backend/src/service/sonarqubeInfoProvider.ts | Expands the fixed metrics requested from SonarQube to include hotspot count, debt minutes, and language distribution. |
| workspaces/sonarqube/.changeset/plenty-donkeys-shave.md | Declares a minor release and documents the additional metrics now fetched. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
security_hotspots,sqale_indexandncloc_language_distributionto the fixed metric listgetFindingsrequests from SonarQube.Why
The list currently fetches
security_hotspots_reviewedandsqale_rating— the percentage of hotspots reviewed and the maintainability grade. Neither carries the underlying figure, so a consumer cannot display:security_hotspots_reviewed(a %)security_hotspotssqale_rating(an A–E grade)sqale_index(minutes)ncloc_language_distributionThere is no way to work around this outside the plugin: the metric list is fixed, and this backend holds the only SonarQube credential, so consumers read whatever
getFindingsreturns and nothing else.Concretely, a dashboard reading
security_hotspotsandsqale_indexfrom the summary renders0for every project while SonarQube itself reports non-zero values for the same keys. I hit this building a dashboard on top of this plugin: across 181 projects it showed zero hotspots and zero debt, while 108 of them had code smells — which is the contradiction that led here.Risk
Low, and the existing tests already demonstrate why.
metricsToQueryintersects the wanted list withapi/metrics/search, so an instance that does not support one of these simply omits it. The tests stub that endpoint withcoverage,code_smells,vulnerabilitiesandunused_metric, so the three new keys are filtered out there and the existingmetricKeys=vulnerabilities%2Ccode_smells%2Ccoverageassertions are unchanged.Nothing that ignores the new keys is affected — this only widens what is available to consumers that ask for it.
Changeset
Included:
minoron@backstage-community/plugin-sonarqube-backend, inworkspaces/sonarqube/.changeset/.