lundi 11 mai 2015

Checkstyle validation fail when needs multiple lines

I need to perform a validation rule on eclipse checkstyle, after a key { of method and before end key } should have a empty line, example:

public void wrongMethod() {
    System.out.println("wrong method");
}

correct

public void correctMethod() {

    System.out.println("correct method");

}    

I try to use a RegexpMultiline in checkstyle rules xml file, doing some like this:

<module name="RegexpMultiline">
    <property name="format" value=".+\{\n.+[;]"/>
    <property name="message" value="should have empty line"/>
</module>  

sure, this Regex expression can be better, the issue is, the multiline behavior works in a regex simulator site with the examples above, but in checkstyle dont. I search on a checkstyle documentation and not found a ready reature for this.

Anyone know a solution for this issue?

thanks.

Aucun commentaire:

Enregistrer un commentaire