We started seeing some failures in our SonarQube background process with the coverity-sonar-plugin at 1.7.3. We updated to 1.7.4 because of the Exception handling added however we are now seeing errors in the sonar scanner (run in our GitLab CI/CD pipeline)
This error only appears for files containing Coverity defects.
java.lang.UnsupportedOperationException: Can not add the same measure twice on <file_name_redacted>.cs:
DefaultMeasure[
component=<file_name_redacted>.cs,
metric=Metric[
id=<null>,
key=ncloc,
description=Non commenting lines of code,
type=INT,
direction=-1,
domain=Size,
name=Lines of Code,
qualitative=false,
userManaged=false,
enabled=true,
worstValue=<null>,
bestValue=<null>,
optimizedBestValue=false,
hidden=false,
deleteHistoricalData=false,
decimalScale=<null>
],
value=9,
fromCore=false
]
With the logic in the scanFiles method of CoverityScanner.java: (lines 60-69)
Hello,
We started seeing some failures in our SonarQube background process with the coverity-sonar-plugin at 1.7.3. We updated to 1.7.4 because of the Exception handling added however we are now seeing errors in the sonar scanner (run in our GitLab CI/CD pipeline)
This error only appears for files containing Coverity defects.
With the logic in the scanFiles method of CoverityScanner.java: (lines 60-69)
https://github.com/coverity/coverity-sonar-plugin/blob/538d108bd6c007edaf21855096e436263e72c19a/src/main/java/org/sonar/plugins/coverity/batch/CoverityScanner.java#L67
It appears that 109 is now redundant and is the cause of the files containing defects to have duplicate NCLOC metrics added.
https://github.com/coverity/coverity-sonar-plugin/blob/538d108bd6c007edaf21855096e436263e72c19a/src/main/java/org/sonar/plugins/coverity/batch/CoverityScanner.java#L109
Please confirm and remove this redundancy. Thank you, Bryan