Sonarqube and plugin to check. Custom rules not working (from template)

I have installed the checkstyle plugin in sonar 5.1 and I want to check if some line exists in my java code for example. BLOCKER in the comments.

I created my own rule com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineCheck and filled in the values.

Checkstyle.xml was created. But sonar returns no problem, but when I run these rules directly from checkstyle warrning you can:

java -jar checkstyle-6.4.1-all.jar -c checkstyle.xml src \ main \ java Start audit ... test.java:5: warning: message Audited.

What's wrong when it is launched from sonarqube?

checkstyle.xml

   <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"><!-- 
    Generated by Sonar -->
<module name="Checker">
    <module name="SuppressionCommentFilter" />
    <module name="SuppressWarningsFilter" />
    <module name="RegexpSingleline">
        <property name="severity" value="warning" />
        <property name="ignoreCase" value="true" />
        <property name="format" value="BLOCKER" />
        <property name="maximum" value="0" />
        <property name="message" value="message" />
        <property name="minimum" value="1" />
    </module>
    <module name="TreeWalker">
        <module name="FileContentsHolder" />
        <module name="SuppressWarningsHolder" />
    </module>
</module>

      

test.java

 /**
 * Hello world!
 * BLOCKER 
 */

import java.util.*;

public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World! 2" );
    }
}

      

+3


source to share





All Articles