Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate NCLOC Metric Error for Files containing Defects #33

Open
bmorenc opened this issue Jun 29, 2020 · 1 comment
Open

Duplicate NCLOC Metric Error for Files containing Defects #33

bmorenc opened this issue Jun 29, 2020 · 1 comment

Comments

@bmorenc
Copy link

bmorenc commented Jun 29, 2020

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.

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)

MetricService.addMetric(sensorContext, CoreMetrics.NCLOC, inputFile.lines(), inputFile);

It appears that 109 is now redundant and is the cause of the files containing defects to have duplicate NCLOC metrics added.

MetricService.addMetric(sensorContext, CoreMetrics.NCLOC, inputFile.lines(), inputFile);

Please confirm and remove this redundancy.
Thank you,
Bryan

@acho0819
Copy link

This issue has been tracked in Synopsys internal JIRA ticket as it was filed from a customer support.
https://jira-sig.internal.synopsys.com/browse/SQP-147

Closing this.

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

No branches or pull requests

2 participants