-
Notifications
You must be signed in to change notification settings - Fork 363
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
cppcheck report results not loaded as issues in Sonar: how to troubleshoot #278
Comments
You can try to search the issues list, many users have reported cppcheck If you want to dig into code, clone the main repository and check the
|
and you should try 0.9.1. https://github.com/wenns/sonar-cxx/releases/tag/cxx-0.9.1 |
I am also faced with a similiar issue but i am using 0.9.1 and tried both sonar 4.4 and Sonar 4.2 to no avail. Execution succeeds but not issues get reported in UI. I am using sonar-runner 2.4 Any help would be appreciated. |
You may:
|
These are mostly path issues
|
@jfallot: Is the issue solved? |
@wenns: no, the issue is still there. Following advices posted here, I again tried using either absolute or source-relative paths, using Windows or Unix separator (the platform is Windows), no improvement. The next step is to make a try with 0.9.1 from source and debug it, but I have many other priorities on top of that... |
This page is a great initiative, however:
"Use always slashes (/) in the configuration file sonar-project.properties as path separator. and later "For all report files use the native path separator of your operating system for path items. This is backslash () on Microsoft Windows and slash (/) on Linux."
|
With report files I mean the xml output of tool like cppcheck and not the setting in the configuration file. How can I make this more clear in the wiki? |
Any progress? |
Yep, I finally found the time to fix the problem. When using modules in the sonar-project.properties file, the reportPath becomes relative to each module subdirectory, which isn't convenient when you have one single cppcheck results file for a complete project. Even using "../" to go up in the relative path doesn't work. Although a reportPath property is defined, the plugIn doesn't emit any warning if no matching report file is not found during analysis. That's only through step by step debugging (I used the latest sources of the master branch) that I have been able to identify this. The only solution I found is to modify the sources to accept an absolute path in the reportPath property, by changing the getReports method of class CxxReportSensor to this: protected List<File> getReports(Settings conf,
String baseDirPath,
String reportPathPropertyKey,
String defaultReportPath) {
String reportPath = conf.getString(reportPathPropertyKey);
if (reportPath == null) {
reportPath = defaultReportPath;
}
reportPath = FilenameUtils.normalize(reportPath);
CxxUtils.LOG.debug("Using pattern '{}' to find reports", reportPath);
File baseDir = new File(baseDirPath);
File reportFile = new File(reportPath);
if(reportFile.isAbsolute()) {
baseDir = reportFile.getParentFile();
reportPath=reportFile.getName();
}
DirectoryScanner scanner = new DirectoryScanner(baseDir,
WildcardPattern.create(reportPath));
return scanner.getIncludedFiles();
} I also had to update CxxReportSensor_getReports_Test class to match that change. I have then been able to complete the analysis and have cppcheck issues reported in Sonar. What should I do to get that code change integrated? Thanks, |
Thx for your analysis. Could you provide a pull request for review and test please. |
hi, i think you are looking for this #252 |
Hello, I just created a pull request to submit the changes I was referring to above, and just added a ref to #252. |
Hi, Can you please share the modified CxxReportSensor class file or share Git location ? I am using Cxx scan in Sonar and facing the same issue. I dont have required environment to compile sonar source code. Thanks, |
Changes reintroduced following the reverts done for SonarOpenCommunity#244
This reverts commit 9603b79.
@jfallot could you test that please with 0.9.3-RC1 |
@guwirth -> close -> release -> re-open if does not work |
Current env:
. Sonar 4.4
. C++ (Community) plugin version 0.9
. Using sonar-runner to run sonar analysis
My problem: although the cppcheck report result is available and the sonar analysis successful (metrics OK), No issues are showing up in Sonar (although there are a lot...).
Checks done:
. Run sonar-runner with -X: not much useful information is dumped about cxx plugin execution
. Numerous tests on cppcheck report path (absolute, relative)
In a previous env:
. Sonar 4.2
. Maven used to launch Sonar analysis
The issues were correctly reported in Sonar.
My Questions:
How can I more deeply debug the C++ plugin when launching the analysis by sonar-runner?
Attach a remote debugger to Sonar server?
What is the right code branch for 0.9 version of the C++ (Community) plugin?
The text was updated successfully, but these errors were encountered: