Sonar插件排除可以配置为本地分析而不使用本地服务器? [英] Can Sonar plugin exclusions be configured for local analysis without a local server?

查看:235
本文介绍了Sonar插件排除可以配置为本地分析而不使用本地服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个中央声纳服务器,用于扫描和报告组织内的所有代码。我们还有Eclipse(RTC)的Sonar插件,以便我们可以在编辑代码时运行本地分析。

We have a central Sonar server for scanning and reporting on all the code within the organization. We also have the Sonar plugin for Eclipse (RTC) so that we can run local analysis as we edit code.

我遇到的问题是我需要设置排除第三方库,因此在运行本地分析时不会被解析。我已经看到了如何在服务器上设置排除,但是我没有权限来更改服务器设置(并且看不到需要进行本地分析)。我也没有在我的开发计算机上运行本地的Sonar服务器,所以我不能将插件指向除中央实例之外的服务器。

The problem I've got is that I need to set exclusions on 3rd party libraries so they don't get parsed when running a local analysis. I've seen how to set exclusions on the server but I don't have permissions to alter the server setup (and don't see the need to do this for a local analysis). I also don't have a local Sonar server running on my dev computer so I can't point the plugin to a server other than our central instance.

所以问题是如何在没有本地声纳服务器(例如 localhost:9000 )的情况下专门为我的本地分析设置排除?我需要创建一个属性文件,设置一个XML文件等吗?如果是这样,那么我在哪里放置它,以便插件获取排除?我尝试在项目文件夹的根目录中设置一个属性文件,其语法如下:

So the question is how do I set exclusions specifically for my local analysis without a local sonar server (e.g. localhost:9000)? Do I need to create a properties file, set an XML file, etc? If so then where do I put it so that the plugin picks up the exclusions? I tried setting a properties file in the root of the project folder with the syntax:

exclusions=/[projectRootFolder]/src/main/java/com/**/*.java

但该文件夹结构中的代码仍然会解析方案

But the code in that folder structure still gets parsed.

推荐答案

Sonar Eclipse插件旨在集中您正在运行的源代码分析工具的配置。

The Sonar Eclipse plugin is designed to centralise the configuration of the source code analysis tools you are running.

必须问的问题是为什么要在本地运行不同的分析?通常,用户希望对本地Eclipse工作区中的文件执行相同的分析,然后再将它们提交到共享代码流中。

A question one must ask is why do you want to run a different analysis locally? Normally users want to execute the same analysis on the files in the local Eclipse workspace, before committing them into the shared code stream.

最后,假设您使用的是Maven可以配置PMD,Checkstyle和Findbugs使用他们的标准Maven插件运行。为了与Sonar同步,您可以下载每个工具的XML配置。以下是Nemo的Sonar方式与Findbugs配置文件的示例:

Finally, assuming you are using Maven it is possible to configure PMD, Checkstyle and Findbugs to run using their standard Maven plugins. In order to sync with Sonar you could download each tool's XML configuration. The following is an example of the "Sonar way with Findbugs" profile from Nemo:

  • http://nemo.sonarsource.org/profiles/permalinks/12

这篇关于Sonar插件排除可以配置为本地分析而不使用本地服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆