我们在AWS节点上运行SonarQube 5.1.2.经过一段时间的使用,通常是一两天后,Sonar Web服务器变得没有响应,并且服务器的CPU会出现问题:
top - 01:59:47 up 2 days, 3:43, 1 user, load average: 1.89, 1.76, 1.11
Tasks: 93 total, 1 running, 92 sleeping, 0 stopped, 0 zombie
Cpu(s): 94.5%us, 0.0%sy, 0.0%ni, 5.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 7514056k total, 2828772k used, 4685284k free, 155372k buffers
Swap: 0k total, 0k used, 0k free, 872440k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2328 root 20 0 3260m 1.1g 19m S 188.3 15.5 62:51.79 java
11 …Run Code Online (Sandbox Code Playgroud) 我们正在使用遗留项目(maven)来设置devop.初学者与詹金斯.Jenkins构建现在没有问题.但是,在将sonarqube与jenkins集成时,我们收到以下错误:
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Error when executing blame for file src/main/java/com/acme/acq/scavenger/AssetCmboItem.java
at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:100)
at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:59)
at org.sonar.batch.scm.ScmSensor.execute(ScmSensor.java:84)
at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:102)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:185)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:264)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:259)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:249)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.batch.scan.ProjectScanContainer.startComponents(ProjectScanContainer.java:127)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonar.runner.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:274)
at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:165)
at …Run Code Online (Sandbox Code Playgroud) 我需要只分析根项目,并忽略嵌套的子模块,但它d
所以我有这个层次结构:
ProjectMain
-src
-subProjectAngular
settings.gradle
Run Code Online (Sandbox Code Playgroud)
我的配置settings.gradle
rootProject.name="ProjectMain"
include 'subProjectAngular'
Run Code Online (Sandbox Code Playgroud)
我只需要分析根项目,并忽略嵌套的子模块,但我得到:
A multi-module project can't have source folders, so 'C:\Users\vagrant\develop-2\site\Source\Site\Vessels\src\main\java' won't be used for the analysis. If you want to analyse files of this folder, y
ou should create another sub-module and move them inside it.
Run Code Online (Sandbox Code Playgroud)
然后我尝试添加多模块配置:
systemProp.sonar.projectKey=site
systemProp.sonar.projectName=vessels-test
systemProp.sonar.projectBaseDir=.
systemProp.sonar.sources=src
systemProp.sonar.modules=javamodule, angularmodule
systemProp.javamodule.sonar.projectName=vessels
systemProp.javamodule.sonar.sources=src
systemProp.javamodule.sonar.projectBaseDir=.
systemProp.javamodule.sonar.language=java
systemProp.angularmodule.sonar.projectName=angular
systemProp.angularmodule.sonar.projectBaseDir=.
systemProp.angularmodule
Run Code Online (Sandbox Code Playgroud)
但在UI处收到消息:未执行任何分析
它仅在我从settings.gradle中删除子项目的定义时才有效,并删除所有子模块配置
我正在使用 MSBuild。我安装了 Java 8。
我正在运行以下命令:
SonarQube.Scanner.MSBuild.exe begin /k:"ABC" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="8b839xxxxxxxxxxxxxxxxxxxxxxx6b00125bf92" /d:sonar.verbose=true
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild
SonarQube.Scanner.MSBuild.exe end /d:sonar.login="8b839xxxxxxxxxxxxxxxxxxxxxxx6b00125bf92"
Run Code Online (Sandbox Code Playgroud)
最后一步失败:
ERROR: Error during SonarQube Scanner execution
ERROR: The 'report' parameter is missing
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
The SonarQube Scanner did not complete successfully
12:53:21.909 Creating a summary markdown file...
12:53:21.918 Post-processing failed. Exit code: 1
Run Code Online (Sandbox Code Playgroud)
MSBuild 版本大于 14。
Java 8 已正确安装。文档表明 Java 8 就足够了。
我们在项目中使用AspectJ,在测试覆盖率报告中也使用Jacoco,当前我们面临一个问题,由于AspectJ在编译阶段更改了字节代码,这使得代码覆盖率报告不正确。一个例子是由于AspectJ添加了额外的if-else语句,然后分支覆盖率显示了1/4之类的东西,但实际上在源代码中没有条件分支。有什么好办法告诉Jacoco忽略AspectJ生成的所有代码?
非常感谢。
引自规则描述(SonarQube 4.5.5):
// Noncompliant - exception is lost (only message is preserved)
try { /* ... */ }
catch (Exception e) { LOGGER.info(e.getMessage()); }
Run Code Online (Sandbox Code Playgroud)
通过向记录器提供异常类,将堆栈跟踪写入日志。
我们代码库中的问题是这样的:通过遵循Tell, don't ask原则,我们使用检查异常作为我们考虑的正常执行路径的一部分,我们不希望它们导致不合理的大日志消息.
几个例子:服务器响应错误代码,数据库语句执行失败,乐观锁定(并发用户)......
我的建议:将这个案例一分为二。
// Noncompliant - exception is lost (only message is preserved)
try { /* ... */ }
catch (Exception e) { LOGGER.info(e.getMessage()); }
Run Code Online (Sandbox Code Playgroud)
和
// Compliant - exception is lost (only message is preserved) but there is business logic handling the situation
try {
/* ... */
} catch …Run Code Online (Sandbox Code Playgroud) 在Sonar 4.5.6(默认设置)中,我看到Duplicated Blocks消息为
我收到消息的java代码如下: -
package com.jabong.orchestratorservice.adapter.order.endpoints;
import com.jabong.orchestratorservice.adapter.order.request.UpdateOrderStatusReadyShipRequest;
public class UpdateOrderReadyShipEndPoint extends BaseOrderEndPoint {
private final static String API_NAME = "setStatusToReadyToShip";
@Override
public String getSourceEndPoint() {
return new StringBuilder("direct:").append(API_NAME).toString();
}
@Override
public String getDestinationEndPoint() {
return new StringBuilder("bean:orderHelper?method=").append(API_NAME).toString();
}
@Override
protected String getName() {
return API_NAME;
}
@Override
protected String getApiInputClassName() {
return UpdateOrderStatusReadyShipRequest.class.getName();
}
}
Run Code Online (Sandbox Code Playgroud)
UpdateOrderStatusReadyShipRequest 也不导入 UpdateOrderReadyShipEndPoint
package com.jabong.orchestratorservice.adapter.order.request;
public class UpdateOrderStatusReadyShipRequest extends BaseOrderRequest {
Run Code Online (Sandbox Code Playgroud)
有人能告诉我这是什么意思吗?
由于我将sonarqube服务器更新为6.1,因此我的gradle项目中出现此错误.
我正在使用声纳插件最新版本(2.2)
classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.2")
谁知道怎么解决呢?
谢谢!
Collections.singletonList即使列表中的值是不可变的,SonarLint 似乎也认为是可变的。这是一个错误还是规则不够智能,无法检查列表类型的可变性?
public static final List<String> STRING_LIST = Collections.singletonList("myString");
Run Code Online (Sandbox Code Playgroud)
Collections.immutableList相反,即使列表中的值是可变的,使用似乎也会消除此错误。
public static final List<Point> POINTS = Collections.unmodifiableList(Collections.singletonList(new Point(1, 2)));
Run Code Online (Sandbox Code Playgroud)
以上运行 SonarQube 6.2。
I had configured Jacoco + Sonar in Maven. I am able to generate the coverage reports for unit tests & display the coverage in Sonar as well. But, unable to generate the reports for integration tests. "jacoco-it.exec" is generated but, when I go and open the index.html, it looks empty. But, there are many integration tests got executed & passed as well. In jacoco-sessions.html, it is clearly mentioned about all the classes which are used internally. Please help me if …