Quantcast

[sonar-dev] Sonar rule with multiple cardinality

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[sonar-dev] Sonar rule with multiple cardinality

Tamás Kende
Hi,

I am planning to implement a regex rule for erlang projects and I do not really understand how can I get a multiple cardinality rules from the active profile...Do I have to get all the rules, iterate over them and check are they with the name what I want? Or is there any proper way? 
With this: rulesProfile.getActiveRuleByConfigKey("Erlang", "B001"); I could only get one rule...
Will the copied rule have a different key starting with B001? I have just started the development, so I cannot really try it out at the moment, and I hope someone knows the answer :)

here is my rule definition:
<rules>
   <rule>
      <key>B001</key>
      <name><![CDATA[regexSingleLine]]></name>
      <configKey>regexSingleLine</configKey>
      <cardinality>MULTIPLE</cardinality>
      <description>
      <![CDATA[ Custom regex which match to a single line of the code. If a match happens, violation will be raised.]]>
      </description>
      <param key="regex" type="TEXT" default="^$">
<description><![CDATA[Regex pattern of the rule.]]></description>
 </param>
 <param key="ignoreCase" type="BOOLEAN" default="false">
  <description><![CDATA[Controls whether to ignore case when searching. Default value is false.]]></description>
 </param>
   </rule>
</rules>

Thanks,

Cheers

Tamas
Loading...