我有一个在maven中配置的项目,代码分析由SonarQube完成.
我正在尝试在pom.xml文件中配置SonarQube以从代码分析中排除一些文件.这些文件可以通过它们的类名来标识,它们在扩展名之前包含下划线字符(它们是元模型类).下面我给出了我尝试排除它们的pom.xml文件的一部分:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<sonar.sources>src/main/java</sonar.sources>
<sonar.exclusions>file:**/src/main/java/**/*_.*</sonar.exclusions>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但是,上面的代码不起作用.有没有办法从我的pom.xml文件配置SonarQube以在分析源代码时忽略这些文件?
先感谢您.
我最近安装了SonarQube 5.0.1,但我找不到将问题标记为假阳性的位置.在以下选项的下拉框中,唯一的选项是"链接到JIRA",我以管理员身份登录.
此功能现在是作为可选插件的一部分提供的吗?
编辑:我添加了一个完全在UI中看到的屏幕截图.
有什么区别btw Sonar Runner和Sonar Scanner?
JDK7需要哪个版本的"Sonarqube"和Sonar跑步者?
如何降低给定代码段的复杂性?我在 Sonarqube 中收到此错误---> 重构此方法以将其认知复杂度从 21 降低到允许的 15。
this.deviceDetails = this.data && {...this.data.deviceInfo} || {};
if (this.data && this.data.deviceInfo) {
this.getSessionInfo();
// tslint:disable-next-line: no-shadowed-variable
const { device, driver, ipAddress, port, active, connectionType } = this.data.deviceInfo;
this.deviceDetails = {
name: device.name || '',
manufacturer: device.manufacturer || '',
deviceType: device.deviceType || '',
model: device.model || '',
description: device.description || '',
managerId: device.deviceManager && device.deviceManager.managerId || null,
locationId: device.location && device.location.locationId || null,
active: device.active,
connectionType: connectionType || null,
driver_id: driver && driver.driverId || …
Run Code Online (Sandbox Code Playgroud) 我在 Sonar 中发现了一条规则:
与其他中间 Stream 操作的一个关键区别是 Stream 实现可以自由地跳过调用以
peek()
达到优化目的。这可能会导致peek()
意外地仅调用 Stream 中的部分元素或不调用任何元素。
另外,Javadoc中也提到了这一点:
此方法的存在主要是为了支持调试,您希望在元素流经管道中的某个点时查看它们
什么情况下可以java.util.Stream.peek()
跳过?和调试有关系吗?
我刚刚在Eclipse中安装了SonarQube,但我不知道如何使用它:
这里说:将项目链接到Sonar服务器
什么是服务器?我们应该在其他地方创建另一个项目,其名称与Eclipse中的项目相同吗?
这真的令人困惑,如果有人可以通过一个小例子帮助我,我将不胜感激.
我的公司有声纳设置各种插件(PMD,FindBugs,CheckStyle),虽然它是非常有用的(它是在每次通过SVN登记触发的Jenkins构建之后运行的),我想它,如果在检查代码之前,我可以在本地计算机上运行这些各种插件.
我们已经在Sonar中设置了一组规则,所以理想情况下我希望能够导出该规则集,或者对数据进行一些修改,然后将生成的规则导入到我的IDE(Netbeans 7.0.1)中.各自的插件.有没有办法做到这一点?我已经搜索了所有内容并且没有通过并手动将每个规则添加到各种插件,似乎没有办法做到这一点.有什么我想念的吗?
TL; DR(摘要):我想从声纳导出配置文件并将规则设置导入Netbeans中的PMD,Findbugs和CheckStyle插件.
我正在努力解决多模块项目的错误,结构很简单,它看起来像这样:
root
module a
module b
module c
pom.xml
Run Code Online (Sandbox Code Playgroud)
使用maven命令行后: clean sonar:sonar deploy
我是这个错误:
无法在项目X上执行目标org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar(default-cli):请使用sonar.java.binaries属性提供项目的已编译类 - > [帮助1]
编辑:这是我的结构 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>groupeId</groupId>
<artifactId>artifactId</artifactId>
<version>version</version>
<packaging>pom</packaging>
<name>${project.artifactId}-parent</name>
<description>description</description>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.3.0.603</version>
</plugin>
</plugins>
</build>
<modules>
<module>module a</module>
<module>module b</module>
<module>module c</module>
</modules>
</project>
Run Code Online (Sandbox Code Playgroud) 我浏览互联网,尝试了一百万种不同的方式,但没有找到答案.
当我使用maven启动时,有没有办法从Sonar分析中排除一些带有源文件的文件夹(例如mvn sonar:sonar)?
SonarQube抱怨" 字符串不包含格式说明符".使用时org.slf4j.Logger
,特别是方法" public void debug(String msg)
".例如
log.info("message");
Run Code Online (Sandbox Code Playgroud)
它指的是这条规则:https://wiki.sei.cmu.edu/confluence/display/c/FIO47-C.+Use+valid+format+strings
但是,在此规则中,我们可以找到以下引用:
每个转换规范由%字符引入(按顺序)by
零个或多个标志(以任何顺序),它们修改转换规范的含义
是我错过了什么,还是这个规则没有得到很好的实施?有这方面的经验吗?
sonarqube ×10
java ×3
maven ×3
angular ×1
checkstyle ×1
eclipse ×1
findbugs ×1
java-8 ×1
java-stream ×1
javascript ×1
jenkins ×1
netbeans ×1
pmd ×1
side-effects ×1
sonar-runner ×1
sonarlint ×1
xml ×1