按类别检索sonarqube规则

时间:2014-01-08 17:29:26

标签: sonarqube

如何获得所有声纳规则的列表(通过webservice或sql查询)及其类别(可维护性,效率,可靠性......等)

使用xxxxx / api / rules?language = java& plugin = pmd,findbugs:

<rule>
<title>Unnecessary Local Before Return</title>
<key>pmd:UnnecessaryLocalBeforeReturn</key>          
<config_key>rulesets/design.xml/UnnecessaryLocalBeforeReturn</config_key> 
<plugin>pmd</plugin>    
<description>Avoid unnecessarily creating local variables</description> 
<priority>MAJOR</priority>
</rule>

技术债务仪表板中显示的类别在哪里?

感谢!!!

2 个答案:

答案 0 :(得分:1)

好的,谢谢!

同时,如果有人有兴趣,我试图用sql脚本来做...

CREATE VIEW lvl3 AS
select c.id, c.rule_id, c.characteristic_order, r.name, r.plugin_rule_key, r.plugin_name, r.language, ce.parent_id
from characteristics c
inner join rules r on c.rule_id=r.id
inner join characteristic_edges ce on c.id=ce.child_id
order by c.rule_id

CREATE VIEW lvl2 AS
select c.id, c.kee, c.name, c.depth, c.characteristic_order, ce.parent_id 
from characteristics c
inner join characteristic_edges ce on c.id=ce.child_id
where depth=2 order by id

CREATE VIEW lvl1 AS
select id, kee, name, depth, characteristic_order 
from characteristics 
where depth=1 order by id

select l3.rule_id as "IdRule", l3.plugin_rule_key as "Name", l3.name as "Descrition", l3.plugin_name "Plugin", l3.language as "Language", l1.name as "Category"
from lvl1 l1
inner join lvl2 l2 on l3.parent_id=l2.id
inner join lvl3 l3 on l2.parent_id=l1.id
order by l3.rule_id

这对我来说现在很好......等待网络服务:)

感谢!!!

答案 1 :(得分:0)

从SonarQube 4.1(2014年1月)开始,这还不可能。

我已为此改进创建了一张票:SONAR-5008