regex - Checkstyle validation fail when needs multiple lines -


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

public void wrongmethod() {     system.out.println("wrong method"); } 

correct

public void correctmethod() {      system.out.println("correct method");  }     

i try use regexpmultiline in checkstyle rules xml file, doing this:

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

sure, regex expression can better, issue is, multiline behavior works in regex simulator site examples above, in checkstyle dont. search on checkstyle documentation , not found ready reature this.

anyone know solution issue?

thanks.

probably run check on files crlf line endings. if yes, remember \r in pattern.

this works me:

<module name="regexpmultiline">     <property name="format" value="\{[\r]?\n(?![\r]?\n)"/>     <property name="message" value="should have empty line"/> </module>   

i've changed couple of things in pattern:


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -