0
votes

I'm using Cppcheck to run analysis on my C++ project and then loading the results into SonarQube. SonarQube is showing the issues, but the technical debt shows 0.

How can I get the technical debt to show up correctly?

I'm running Cppcheck with this command:

"C:\Program Files (x86)\Cppcheck\cppcheck.exe" -v --enable=all --xml --xml-version=1 "C:\Users\tim\Documents\Visual Studio 2013\Projects\TestCpp" 2> cppcheck-TestCpp.xml

My sonar-project.properties file:

sonar.projectKey=TestCpp
sonar.projectVersion=1.0
sonar.projectName=Temp cpp Test

sonar.sources=.
sonar.language=c++

sonar.sourceEncoding=UTF-8

#Cppcheck
sonar.cxx.cppcheck.reportPath=cppcheck-*.xml

This is the test code I'm running it against:

int main()
{
    // unused variable
    int nTmp = 0;

    // index out of bounds
    char a[10];
    a[10] = 0;

    return 0;
}

SonarQube is showing 3 issues from this code and 0 technical debt. What else do I need to do to show the technical debt?

I'm running SonarQube version 4.4 and Sonar Runner version 2.3

I've run sonar-runner with debug logging and I'm not seeing any errors loading the Cppcheck results.

Cppcheck version 1.63

I should also mention this is using the C++ Community plugin version 0.9.0

1
There's something missing in this question. Try it again tomorrow.Hans Passant
@HansPassant updated the question to actually have a question.Tim
I guess the answer is : the C++ community plugin doesn't provide a SQALE mapping (including the SQALE remediation function) for the CPPCheck rules.Freddy - SonarSource Team
@FreddyMallet-SonarSource you're right, I checked and there is a newer version of the plugin that has the SQALE mapping listed as one of the new features. I updated to that and boom, technical debt shows up.Tim

1 Answers

1
votes

I was able to get this issue fixed by downloading the latest version of the c++ community plugin (v0.9.1)

Now the technical debt is showing up (40 mins for the 3 issues).