Reputation: 33
I am trying to developing sonar plugin. But i couldnt get rule with params. Here my custom rule.
<?xml version="1.0" encoding="UTF-8"?>
<rules>
<rule>
<key>custom-rule-key</key>
<name>custom rule</name>
<configKey>custom-rule-key</configKey>
<description>this is custom rule</description>
<priority>MINOR</priority>
<param>
<key>the-param-key</key>
<tag>style</tag>
<tag>security</tag>
<description>
<![CDATA[the param-description]]>
</description>
<defaultValue>42</defaultValue>
</param>
</rule>
</rules>
I can see it on sonarqube interface and i can change param value from interface. But as i mentioned, i couldnt reach rule and value of param from code. Do you have any idea? Thanks.
Upvotes: 1
Views: 975
Reputation: 5136
I suppose that you need to load the rule configuration from scanners ("Sensor" extension point). In this case the component org.sonar.api.batch.rule.ActiveRules must be used and injected in your sensor.
Upvotes: 1