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

CppCheck result is not shown in Sonar #5

Closed
alustrement opened this issue Nov 18, 2015 · 15 comments
Closed

CppCheck result is not shown in Sonar #5

alustrement opened this issue Nov 18, 2015 · 15 comments

Comments

@alustrement
Copy link

After a successfull analysis, cppcheck-result-0.xml contains this :

<results>
    <error file="C:\Sandbox\NativeCalc\NativeCalc\Operations.cpp" line="22" id="zerodiv" severity="error" msg="Division by zero."/>
    <error file="C:\Sandbox\NativeCalc\NativeCalc\NativeCalc.cpp" line="12" id="variableScope" severity="style" msg="The scope of the variable &apos;a&apos; can be reduced."/>
    <error file="C:\Sandbox\NativeCalc\NativeCalc\NativeCalc.cpp" line="12" id="variableScope" severity="style" msg="The scope of the variable &apos;b&apos; can be reduced."/>
    <error file="C:\Sandbox\NativeCalc\NativeCalc\NativeCalc.cpp" line="12" id="variableScope" severity="style" msg="The scope of the variable &apos;result&apos; can be reduced."/>
    <error id="missingIncludeSystem" severity="style" msg="Cppcheck cannot find all the include files (use --check-config for details)"/>
</results>

but no issue is raised in SonarQube. I confirm the "Division by zero" rule is activated.

@jmecosta
Copy link
Owner

dump the analysis log to file and search for the cppcheck sensor and what report string is it take.

also what is your sonar version?

@alustrement
Copy link
Author

I use SonarQube 5.2 (fresh sandbox install yesterday with all latest versions)
This is all I found in the dump :

Task "CppCheckTask"
  CppCheckCopCommand: C:\Program Files (x86)\Cppcheck\cppcheck.exe --xml --inline-suppr --enable=all -j 8 -D__cplusplus C:\Sandbox\NativeCalc
  Total Violations: 8
  CppCheck End: 59 ms

@jmecosta
Copy link
Owner

exactly cxx plugin does not support 5.2, your best alternative is to try to
compile this
SonarOpenCommunity/sonar-cxx#681

ive tested and it works. however we might not even release it to 5.2
because this means braking people statistics. you can read the details in
th pr

On Wed, 18 Nov 2015 at 12:11 alustrement [email protected] wrote:

I use SonarQube 5.2 (fresh sandbox install yesterday with all latest
versions)
This is all I found in the dump :

Task "CppCheckTask"
CppCheckCopCommand: C:\Program Files (x86)\Cppcheck\cppcheck.exe --xml --inline-suppr --enable=all -j 8 -D__cplusplus C:\Sandbox\NativeCalc
Total Violations: 8
CppCheck End: 59 ms


Reply to this email directly or view it on GitHub
#5 (comment)
.

@alustrement
Copy link
Author

Can you send me the jar file ? I don't have any java dev env and this will me do saving time. Thank you very much

@jmecosta
Copy link
Owner

Sure

On Wed, Nov 18, 2015, 14:52 alustrement [email protected] wrote:

Can you send me the jar file ? I don't have any java dev env and this will
me do saving time. Thank you very much


Reply to this email directly or view it on GitHub
#5 (comment)
.

@alustrement
Copy link
Author

no results in Sonar 5.2 or 5.1.2 with this jar.
no results in Sonar 5.1.2 with the 0.9.4 jar.
I am doing sth wrong ?

@jmecosta
Copy link
Owner

In 5.2 I sent you should take a look at the log and see what reports is he
trying to pick up, likely you have those defined in the property file and
its not picking up correctly the path. Could you send me the last part
after the end phase?

On Wed, Nov 18, 2015, 18:37 alustrement [email protected] wrote:

no results in Sonar 5.2 or 5.1.2 with this jar.
no results in Sonar 5.1.2 with the 0.9.4 jar.
I am doing sth wrong ?


Reply to this email directly or view it on GitHub
#5 (comment)
.

@alustrement
Copy link
Author

In the generated sonar-project.properties the path is ok (verified by copy/paste) :

sonar.cxx.cppcheck.reportPath=C:/Sandbox/NativeCalc/.cxxresults/reports-cppcheck/*.xml

but you're right there is sth wrong this it :

09:46:58.697 INFO  - Sensor CxxCppCheckSensor
09:46:58.697 DEBUG - Using pattern 'C:\Sandbox\NativeCalc\.cxxresults\reports-cppcheck\*.xml' to find reports
09:46:58.697 DEBUG - Search string transformed from 'C:\Sandbox\NativeCalc\.cxxresults\reports-cppcheck\*.xml'
09:46:58.697 DEBUG - To ':\Sandbox\NativeCalc\.cxxresults\reports-cppcheck\*.xml' to find reports, using base Path 'C:\Sandbox\NativeCalc\NativeCalc'
09:46:58.698 WARN  - Cannot find a report for 'sonar.cxx.cppcheck.reportPath=:\Sandbox\NativeCalc\.cxxresults\reports-cppcheck\*.xml'

@jmecosta
Copy link
Owner

ok, i will fix it. for now you can just remove the entry
sonar.cxx.cppcheck.reportPath=C:/Sandbox/NativeCalc/.
cxxresults/reports-cppcheck/*.xml from the properties file.

On Thu, 19 Nov 2015 at 10:49 alustrement [email protected] wrote:

In the generated sonar-project.properties the path is ok (verified by
copy/paste) :

sonar.cxx.cppcheck.reportPath=C:/Sandbox/NativeCalc/.cxxresults/reports-cppcheck/*.xml

but you're right there is sth wrong this it :

09:46:58.697 INFO - Sensor CxxCppCheckSensor
09:46:58.697 DEBUG - Using pattern 'C:\Sandbox\NativeCalc.cxxresults\reports-cppcheck*.xml' to find reports
09:46:58.697 DEBUG - Search string transformed from 'C:\Sandbox\NativeCalc.cxxresults\reports-cppcheck*.xml'
09:46:58.697 DEBUG - To ':\Sandbox\NativeCalc.cxxresults\reports-cppcheck*.xml' to find reports, using base Path 'C:\Sandbox\NativeCalc\NativeCalc'
09:46:58.698 WARN - Cannot find a report for 'sonar.cxx.cppcheck.reportPath=:\Sandbox\NativeCalc.cxxresults\reports-cppcheck*.xml'


Reply to this email directly or view it on GitHub
#5 (comment)
.

@alustrement
Copy link
Author

This works :

sonar.cxx.cppcheck.reportPath=C:/Sandbox/NativeCalc/.cxxresults/reports-cppcheck/cppcheck-result-0.xml

@jmecosta
Copy link
Owner

interesting, thought i add cover the *.xml. anyway. if you have it defined in you sonar-project.properties you can just leave it out. it will recreate it for you automatically

@jmecosta
Copy link
Owner

i can reproduce this behaviour with the 5.2 version of the cxx plugin i set.

14:45:56.915 DEBUG - Using pattern 'D:\prod\structures\Core\Common.cxxresults\reports-cppcheck*.xml' to find reports
14:45:56.915 DEBUG - Search string transformed from 'D:\prod\structures\Core\Common.cxxresults\reports-cppcheck*.xml'
14:45:56.915 DEBUG - To '.cxxresults\reports-cppcheck*.xml' to find reports, using base Path 'D:\prod\structures\Core\Common'
14:45:56.916 DEBUG - Report '.cxxresults\reports-cppcheck\cppcheck-result-0.xml'
14:45:56.916 INFO - Processing report 'D:\prod\structures\Core\Common.cxxresults\reports-cppcheck\cppcheck-result-0.xml'
14:45:56.916 INFO - Parsing 'Cppcheck V2' format
14:45:56.916 INFO - Parsing 'Cppckeck V1' format

was this error in with version

@jmecosta
Copy link
Owner

same issue as here:SonarOpenCommunity/sonar-cxx#683 (comment)

@jmecosta
Copy link
Owner

@alustrement the now the fix is merged in the sonar-cxx plugin. it should now work properly

https://ci.appveyor.com/api/buildjobs/rncf9yqkbanbcwi5/artifacts/sonar-cxx-plugin/target/sonar-cxx-plugin-0.9.5-SNAPSHOT.jar

i will close this. please re-open if still a issue. download last version from: https://github.com/SonarOpenCommunity/sonar-cxx-msbuild-tasks/releases/tag/1.2.1-RC1

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