No bugs shown from cppcheck in Sonarqube

652 views
Skip to first unread message

SK

unread,
Jan 24, 2017, 3:32:14 PM1/24/17
to SonarQube
Hi.  

   Sonarqube is not reporting any bugs eventhough they are there in the cpp check report. 

I am running this to get the cppcheck report

cppcheck --xml-version=2  xcipio/LIS/src/CLIENTLIB 2> xcipio/cpp_clientlib.xml

I have tried with xml version 1 as well

Sonar project properties is like this:

sonar.projectKey=my:full-xcipio-Xcipio_Feature_Dev_master-CLIENTLIB
sonar.projectVersion=1.0
sonar.projectName=full-xcipio-Xcipio_Feature_Dev_master-CLIENTLIB
sonar.sources=xcipio/LIS/src/CLIENTLIB
sonar.cxx.includeDirectories=ACEROOT/inc/ace,ACEROOT/inc/ace/os_include
sonar.sourceEncoding=UTF-8
sonar.profile=xcipio-sonar-way-rules
sonar.cxx.cppcheck.reportPath=/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/cpp_clientlib.xml
sonar.exclusions=**/CtapMediationMsg.C,**/EIMSValidationTestSuite.H

Analysis is successful but sonar scanner reports that it cannot find the files.  When I do a 'ls' on the file, its very much there.  I don't know what I'm doing wrong.  

INFO: Searching reports by relative path with basedir '/home/support/jenkins/jenkins20/workspace/xcipio-workspace' and search prop 'sonar.cxx.cppcheck.reportPath'
INFO: Scanner found '1' report files
INFO: Parser will parse '1' report files
INFO: Processing report '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/cpp_clientlib.xml'
WARN: Cannot find the file '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/GenericMessageClass.C', skipping violations
WARN: Cannot find the file '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/Generic_BearerCapability.C', skipping violations
WARN: Cannot find the file '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/Generic_EncryptionInformation.C', skipping violations
WARN: Cannot find the file '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/Generic_NotificationDataList.C', skipping violations
WARN: Cannot find the file '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/Generic_OctetString.C', skipping violations
WARN: Cannot find the file '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/Generic_PacketInformation.C', skipping violations
WARN: Cannot find the file '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/Generic_Payload.C', skipping violations
WARN: Cannot find the file '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/Generic_TargetIdentity.C', skipping violations
WARN: Cannot find the file '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/IS41C_Class.C', skipping violations
INFO: Added report '/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/cpp_clientlib.xml' (parsed by: CppcheckParserV2)
INFO: CppCheck Errors processed = 0
INFO: Sensor CxxCppCheckSensor (done) | time=70ms


The files are there:

[sup...@10.0.156.73 xcipio-workspace]$ ls /home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/GenericMessageClass.C
/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/GenericMessageClass.C

[sup...@10.0.156.73 xcipio-workspace]$ ls /home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/Generic_Payload.C
/home/support/jenkins/jenkins20/workspace/xcipio-workspace/xcipio/LIS/src/CORE/GENMSG/lib/Generic_Payload.C


There are valid errors in the cpp report as well

<error id="arrayIndexOutOfBounds" severity="error" msg="Array &apos;printablePayloadStr[28]&apos; accessed at index 35, which is out of bounds." verbose="Array &apos;printablePayloadStr[28]&apos; accessed at index 35, which is out of bounds." cwe="119">
            <location file="xcipio/LIS/src/CLIENTLIB/GENVOIP/GenClientLib/src/Generic_Payload.C" line="493"/>
</error>

Please help!  


G. Ann Campbell

unread,
Jan 25, 2017, 3:24:11 AM1/25/17
to SonarQube
Hi,

You should direct questions related to the Cxx plugin here: https://github.com/SonarOpenCommunity/sonar-cxx


Ann

SK

unread,
Jan 25, 2017, 1:22:26 PM1/25/17
to SonarQube
Yes, sorry, I realized that late last night.  Anyways, let this thread be here for people with similar issues in the future.  :)

The first fix is to have ant based report path.  This is a case of my not RTFM

sonar.cxx.cppcheck.reportPath=./cpp_checkreport.xml should have been

sonar.cxx.cppcheck.reportPath=**/cpp_checkreport.xml

Secondly, cpp check does not follow soft links.  Turns our those files were skipped because they were valid softlinks.  

thanks
Sam
Reply all
Reply to author
Forward
0 new messages