Make Windows-friendly

* SuppressionFilter now replaces \ with / before patterh matching
* Added strict UNIX line separator check
* Revived NewlineAtEndOfFile check with UNIX line separator
* Confirmed checkstyle doesn't complain anymore in Windows
This commit is contained in:
Trustin Lee 2012-03-02 10:19:33 -08:00
parent 735aa8ff45
commit 381814f6da
2 changed files with 10 additions and 6 deletions

View File

@ -10,7 +10,7 @@ import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck;
public class SuppressionFilter extends AutomaticBean implements Filter {
private static final Pattern JAVA5PATTERN = Pattern.compile("[\\\\/]org[\\\\/]jboss[\\\\/]");
private static final Pattern JAVA5PATTERN = Pattern.compile("/org/jboss/");
private Pattern pattern;
private Pattern examplePattern = Pattern.compile("examples?");
@ -25,16 +25,17 @@ public class SuppressionFilter extends AutomaticBean implements Filter {
@Override
public boolean accept(AuditEvent evt) {
if (JAVA5PATTERN.matcher(evt.getFileName()).find()) {
String filename = evt.getFileName().replace('\\', '/');
if (JAVA5PATTERN.matcher(filename).find()) {
if (evt.getSourceName().endsWith("MissingOverrideCheck")) {
return false;
}
}
if (pattern.matcher(evt.getFileName()).find()) {
if (pattern.matcher(filename).find()) {
return false;
}
if (examplePattern.matcher(evt.getFileName()).find()) {
if (examplePattern.matcher(filename).find()) {
if (evt.getSourceName().endsWith(".JavadocPackageCheck")) {
return false;
}

View File

@ -9,8 +9,7 @@
<module name="FileTabCharacter"/>
<module name="JavadocPackage"/>
<module name="NewlineAtEndOfFile">
<!-- Ignore as this is not possible in windows -->
<property name="severity" value="ignore" />
<property name="lineSeparator" value="lf" />
</module>
<module name="RegexpSingleline">
<property name="format" value="^(\s|\*)*Copyright\s+[0-9]+\s+The Netty Project\s*$"/>
@ -21,6 +20,10 @@
<property name="format" value="(@(author|version)|\(non-Javadoc\))"/>
<property name="ignoreCase" value="true"/>
</module>
<!-- Force UNIX line separator -->
<module name="RegexpSingleline">
<property name="format" value="\r"/>
</module>
<module name="TreeWalker">
<module name="WhitespaceAfter"/>