SONAR - C代码分析

时间:2013-05-30 14:03:50

标签: c++ code-analysis sonarqube static-analysis

我正在尝试用声纳检查.cpp代码,但我遇到了问题。

声纳版本:3.5.1 // MySQL 5.0.67

我的声纳上安装了这个插件。

Sonar C ++社区插件[cxx]版本:0.2 Sonar的C ++插件(社区版) 许可证:GNU LGPL v3

13:15:52.240 INFO  -   **/package-info.java
13:15:52.257 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@eb7c20[id=415,key=glitewms,qualifier=TRK], with key batch-glitewms
13:15:52.300 DEBUG - To prevent a memory leak, the JDBC Driver [com.mysql.jdbc.Driver] has been forcibly deregistered
13:15:52.302 DEBUG - Delete temporary directory: /tmp/sonar-batch53431674173176591171032930116386070
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 4.852s
Final Memory: 7M/22M
INFO: ------------------------------------------------------------------------

ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:79)
        at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:63)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:57)
        at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
        at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:71)
        at org.sonar.runner.api.Runner.execute(Runner.java:89)
        at org.sonar.runner.Main.executeTask(Main.java:70)
        at org.sonar.runner.Main.execute(Main.java:59)
        at org.sonar.runner.Main.main(Main.java:41)
Caused by: org.sonar.api.utils.SonarException: **Language with key 'cpp' not found
        at** org.sonar.batch.phases.ProjectInitializer.initLanguage(ProjectInitializer.java:50)
        at org.sonar.batch.phases.ProjectInitializer.execute(ProjectInitializer.java:44)
        at org.sonar.batch.phases.Phases.execute(Phases.java:93)
        at org.sonar.batch.scan.ScanContainer.doStart(ScanContainer.java:147)
        at org.sonar.batch.bootstrap.Container.start(Container.java:72)
        at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:65)
        at org.sonar.batch.scan.ScanTask.scanRecursively(ScanTask.java:56)
        at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:49)
        at org.sonar.batch.bootstrap.TaskContainer.doStart(TaskContainer.java:188)
        at org.sonar.batch.bootstrap.Container.start(Container.java:72)
        at org.sonar.batch.bootstrap.TaskBootstrapContainer.executeTask(TaskBootstrapContainer.java:73)
        at org.sonar.batch.bootstrap.TaskBootstrapContainer.doStart(TaskBootstrapContainer.java:62)
        at org.sonar.batch.bootstrap.Container.start(Container.java:72)
        at org.sonar.batch.bootstrap.BootstrapContainer.doStart(BootstrapContainer.java:104)
        at org.sonar.batch.bootstrap.Container.start(Container.java:72)
        at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:88)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:72)
        at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:75)
        ... 9 more

在项目的属性文件中我把它: sonar.language = CPP

如果我更改cpp,并尝试使用c ++或C,则运行程序执行正常,但报告不正确。

是否有任何建议可以解决此问题或其他替代方案?

2 个答案:

答案 0 :(得分:0)

当您使用Sonar C ++社区插件时,语言不是cpp而是cxx,请参阅http://docs.codehaus.org/pages/viewpage.action?pageId=185073817

答案 1 :(得分:0)

我认为C ++(社区)插件的语言是c ++,这里定义为http://docs.codehaus.org/display/SONAR/Running+the+analysis,c或cpp用于C / C ++(SonarSource)插件。