Skip to content

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

@ktzsolt

Description

@ktzsolt

Describe the bug

In the docx report the following metrics show the sum of metric of all source file instead of max of the metric of all source files.
Cyclomatic Complexity XX-MAXCOMPLEXITY-XX
Cognitive Complexity XX-MAXCOGNITIVECOMPLEXITY-XX
Lines of code per file XX-MAXNCLOC-XX

The rest shows correctly the max value of all files as expected
Comment density (%) XX-MAXCOMMENTDENSITY-XX
Coverage XX-MAXCOVERAGE-XX
Duplication (%) XX-MAXDUPLICATION-XX

Example, for cyclomatic complexity the sum of all cyclomatic complexity is 815 but the max (on the screenshot) is 32 so 32 should be shown in the generated reports

Image

docx report:

Image

To reproduce

  1. generate docx reports
  2. Compare the metrics range table with values shown in sonarqube UI

Expected behavior

The max value should be shown for the 3 metrics:
Cyclomatic Complexity XX-MAXCOMPLEXITY-XX
Cognitive Complexity XX-MAXCOGNITIVECOMPLEXITY-XX
Lines of code per file XX-MAXNCLOC-XX

just like it is for these three:
Comment density (%) XX-MAXCOMMENTDENSITY-XX
Coverage XX-MAXCOVERAGE-XX
Duplication (%) XX-MAXDUPLICATION-XX

User environment

  • Sonarqube: v10.7 Community Edition
  • sonar-cnes-report: 5.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions