Skip to content

Conversation

@ktzsolt
Copy link

@ktzsolt ktzsolt commented Aug 28, 2025

Fix complexity, cognitive_complexity, ncloc metrics from project-level metrics (sum of all files) to file-level metrics (max of all files).

Tested with Sonarqube server version: 10.7.0.96327
Added Dockerfile for convinience.
Updated pom.xml version to 5.0.3

Disclosure: I used Github Copilot to help with the change. Code is reviewed, built and application is manually tested by me to the best of my knowledge, before submitting this PR.

Proposed changes

The sonarqube api was not called with the qualifiers=FIL parameter, so for some metrics the reports showed the sum of all metrics of all files instead of the max of all files.

Example:
Sonarqube UI shows this for Cyclomatic Complexity:
The sum of all files is 1238 but the max value on file-by-file basis is 108
image

Before the fix we see the 1238 value for max in the report:
image

After the fix we see 108 in the report that is max on a file-by-file basis:
image

Types of changes

What types of changes does your code introduce to this software?

Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Issues closed by changes

List here all issues closed by your changes. Use a list of items like - [x] Close #0

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I agree with the CODE OF CONDUCT
  • Lint and unit tests pass locally with my changes
  • SonarCloud and Travis CI tests pass with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

…om project-level metrics (sum of all files) to file-level metrics (max of all files)
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.

docx report shows sum of metrics for some metrics instead of max in "Metrics Range" table

1 participant