Checkstyle RegexpHeader not detecting regex properly

Viewed 855

I'm trying to add a checkstyle config for how code files should begin in the codebase. The format I want can be described by a pattern in java - ^package .*\n\n.*. However, this pattern doesn't seem to work when I use it with RegexpHeader. Here is my config -

<module name="RegexpHeader">
    <property name="header" value="^package .*\n\n.*"/>
    <property name="fileExtensions" value="java"/>
</module>

And it doesn't seem to fail for this -

package my.checkstyle.frustrations;
/**
 * Hello world!
 *
 */
public class ShouldFail
{
}

I have created a sample project here.

1 Answers
Related