简体   繁体   English

如何在Sonarqube中导入新的Java插件规则

[英]How to import new java plugin rules in Sonarqube

I am using Sonarqube 5.2. 我正在使用Sonarqube 5.2。 with Java Plugin 3.8 . Java插件3.8版。 Looks like there are 339 Rules for Java in the Java plugin. 看起来Java插件中有339个Java规则。 However, in the default quality profile there are 234 rules. 但是,在默认质量配置文件中,有234条规则。

I believe this is because initially I had Java Plugin 3.0 which had 234 rules due to which the default quality profile also has the same number of rules. 我相信这是因为最初我有Java Plugin 3.0,它具有234条规则,因此默认质量配置文件也具有相同数量的规则。

Now since i have upgraded the Java plugin to 3.8 there are new rules but those aren't part of the default quality profile. 现在,由于我已将Java插件升级到3.8,因此有一些新规则,但这些规则不属于默认质量配置文件。

So how do i implement the remaining 105 rules. 那么我该如何执行其余的105条规则。 Do i have to create a new quality profile, if yes then how do i import the new rules from Java plugin into the quality profile. 我是否必须创建一个新的质量配置文件,如果是,那么如何将新规则从Java插件导入质量配置文件。

Alternatively can I change the default profile and add the missing rules to it ? 另外,我可以更改默认配置文件并向其中添加缺少的规则吗?

You can "Restore Built-in Profiles" by language (look under the arrow menu next to "Create") to catch them up to their most current versions. 您可以按语言“还原内置配置文件”(在“创建”旁边的箭头菜单下查看)以将其赶上最新版本。

You can copy one profile to another in the Rules space. 您可以在“规则”空间中将一个配置文件复制到另一个配置文件。 Use the "Quality Profile" search facet to find all the rules active in your source profile, then use Bulk Change to activate them in your target profile. 使用“质量配置文件”搜索构面查找源配置文件中所有活动的规则,然后使用批量更改在目标配置文件中激活它们。

If I were you, I'd do both: create a new profile, copy your current default profile into it (I'm assuming Sonar way is your current default), then Restore Built-in Profiles for Java. 如果您是我,那么我会两者都做:创建一个新的配置文件,将当前的默认配置文件复制到其中(我假设Sonar方式是您当前的默认配置),然后还原Java内置配置文件。 At that point you can use the profile comparison feature to see what changes have been made in the default profile and decide individually whether to apply them in your (new) default profile. 此时,您可以使用配置文件比较功能来查看默认配置文件中进行了哪些更改,并分别决定是否将其应用到(新的)默认配置文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM