- Sonarqube扫描c++代码
- 1.下载cppcheck和插件
- 2.配置sonarqube
- 2.1 配置相应的规则
- 2.2 配置相应的xml文件路径
- 3.进行配置文件
- 4.查看结果
插件的下载地址为:https://github.com/SonarOpenCommunity/sonar-cxx
cppcheck下载地址:http://cppcheck.net/
然后生成xml文档
我生成的xml文件:
生成的error:
这里的路径要和配置文件的路径保持一致。
官网给的hello-world很有参考价值:
https://github.com/SonarOpenCommunity/sonar-cxx/tree/master/integration-tests/testdata/hello_world
sonar-project.properties
# metadata sonar.projectKey=hello_world # disable SCM support sonar.scm.disabled=true # file extensions assigned to the cxx programming language sonar.cxx.file.suffixes=.cxx,.cpp,.cc,.c,.hxx,.hpp,.hh,.h # comma-separated paths to directories containing source files sonar.sources=src # comma-separated list of directories where the plugin should search for include files sonar.cxx.includeDirectories=src # paths to the cppcheck report sonar.cxx.cppcheck.reportPaths=reports/cppcheck.xml # 需要添加上传的url!,此处没有写。4.查看结果
扫描成功后的结果为:



