Quality profile contains duplicates

18 views
Skip to first unread message

peter....@gmail.com

unread,
Jul 14, 2017, 4:54:05 AM7/14/17
to SonarQube
Hi all,

is it possible to duplicate a rule with a different configuration?

Specifically, I need to duplicate the checkstyle:com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck rule to check for correct line wrapping: comma has to be at the end of line and dot and double colon at new line. Checkstyle itself can be configured as such, however I cannot find any resources about how to achieve the same thing in SonarQube Quality Profiles.

My profile XML looks like this now and it's rejected by SonarQube with the following message:
The quality profile cannot be restored as it contains duplicates for the following rules: checkstyle:com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck

    <rule>
     
<repositoryKey>checkstyle</repositoryKey>
     
<key>com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck</key>
     
<priority>CRITICAL</priority>
     
<parameters>
       
<parameter>
         
<key>tokens</key>
         
<value>COMMA</value>
       
</parameter>
       
<parameter>
         
<key>option</key>
         
<value>eol</value>
       
</parameter>
     
</parameters>
   
</rule>
   
<rule>
     
<repositoryKey>checkstyle</repositoryKey>
     
<key>com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck</key>
     
<priority>MAJOR</priority>
     
<parameters>
       
<parameter>
         
<key>tokens</key>
         
<value>DOT,METHOD_REF</value>
       
</parameter>
       
<parameter>
         
<key>option</key>
         
<value>nl</value>
       
</parameter>
     
</parameters>
   
</rule>

Is there any way how to tell SonarQube to treat the configuration as two separate rules?

Thanks

Peter Kovac

G. Ann Campbell

unread,
Jul 17, 2017, 10:19:11 AM7/17/17
to SonarQube, peter....@gmail.com
Hi Peter,

That kind of functionality is only available for template rules. I'm not familiar with the Checkstyle rule set, but off hand I'm going to guess it's not a template rule. Your best bet would be to contact the Checkstyle maintainers here: https://github.com/checkstyle/sonar-checkstyle


Ann
Reply all
Reply to author
Forward
0 new messages