在使用声纳一段时间后,每种语言都有不同的项目,我现在正在尝试使用多语言(C ++和Java)和多模块项目(SonarQube 4.4使用solar-runner)的新功能。 / p>
但是,生成的大多数结果(Metrics,Issues)仅涉及Java,而少数部分(无用代码,配置文件)也涉及C ++。
在查看日志时,我注意到虽然检测到了C ++语言,但未调用相关的C ++传感器:
------------- Scan cg 18:38:45.607 INFO - Load module settings 18:38:48.088 INFO - Loading rules... 18:38:49.460 INFO - Loading rules done: 1372 ms 18:38:49.492 INFO - Configure Maven plugins 18:38:49.585 INFO - Compare to previous analysis (2014-08-08) 18:38:49.601 INFO - Compare over 30 days (2014-07-09, analysis of 2014-08-08 18:05:54.0) 18:38:49.601 INFO - No quality gate is configured. 18:38:50.131 INFO - Base dir: D:\Projects\ivserver\trunk\src\cg 18:38:50.131 INFO - Working dir: D:\Projects\ivserver\trunk\src\.sonar\com.infovista_ivserver_cg 18:38:50.131 INFO - Source dirs: D:\Projects\ivserver\trunk\src\cg 18:38:50.131 INFO - Source encoding: UTF-8, default locale: en_US 18:38:50.131 INFO - Index files 18:38:50.162 INFO - Excluded sources: 18:38:50.162 INFO - **/*.vspscc 18:38:50.162 INFO - **/*.sh 18:38:51.972 INFO - 653 files indexed 18:38:58.867 INFO - Quality profile for c++: Default C++ Profile 18:38:59.507 INFO - Sensor QProfileSensor... 18:38:59.522 INFO - Sensor QProfileSensor done: 15 ms 18:38:59.522 INFO - Sensor CpdSensor... 18:38:59.522 INFO - SonarBridgeEngine is used for c++ 18:38:59.538 INFO - Cross-project analysis disabled 18:39:04.202 INFO - Sensor CpdSensor done: 4680 ms 18:39:04.202 INFO - Sensor InitialOpenIssuesSensor... 18:39:04.218 INFO - Sensor InitialOpenIssuesSensor done: 16 ms 18:39:04.218 INFO - Sensor ProjectLinksSensor... 18:39:04.249 INFO - Sensor ProjectLinksSensor done: 31 ms 18:39:04.249 INFO - Sensor VersionEventsSensor... 18:39:04.249 INFO - Sensor VersionEventsSensor done: 0 ms 18:39:04.249 INFO - Sensor FileHashSensor... 18:39:04.280 INFO - Sensor FileHashSensor done: 31 ms 18:39:04.858 INFO - Execute decorators...
我错过了什么?
这是我的项目文件:
sonar.projectKey=com.acme:orange
sonar.projectName=Orange Juice
sonar.projectVersion=trunk
sonar.modules=cg,ct,lg,sv,install,java
sonar.sources=.
install.sonar.sources=src
java.sonar.sources=app/api, app/cli
sonar.cxx.cppcheck.reportPath=target/cppcheck/report.xml
sonar.cxx.cppncss.reportPath=target/cppncss/report.xml
sonar.cxx.cppcheck.path=D:/CppCheck/cppcheck.exe
答案 0 :(得分:1)
我通过强制每个模块的语言向前迈出了一步(见下文)。 现在可以正确计算度量标准。
我剩下的问题是C ++问题没有像过去那样报告,我只得到Java的问题(在多个模块的情况下报告错误解释的相对路径?)
sonar.projectKey=com.acme:orange
sonar.projectName=Orange Juice
sonar.projectVersion=trunk
sonar.modules=cg,ct,lg,sv,install,java
sonar.sources=.
sonar.language=c++
java.sonar.language=java
install.sonar.language=java
install.sonar.sources=src
java.sonar.sources=app/api, app/cli
sonar.cxx.cppcheck.reportPath=target/cppcheck/report.xml
sonar.cxx.cppncss.reportPath=target/cppncss/report.xml
sonar.cxx.cppcheck.path=D:/CppCheck/cppcheck.exe