Disable JavadocPackageCheck for examples
This commit is contained in:
parent
cb4fa327a2
commit
0bbf677b7c
@ -6,18 +6,32 @@ import com.puppycrawl.tools.checkstyle.api.AuditEvent;
|
||||
import com.puppycrawl.tools.checkstyle.api.AutomaticBean;
|
||||
import com.puppycrawl.tools.checkstyle.api.Filter;
|
||||
import com.puppycrawl.tools.checkstyle.api.FilterSet;
|
||||
import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck;
|
||||
|
||||
public class SuppressionFilter extends AutomaticBean implements Filter {
|
||||
|
||||
private FilterSet filters = new FilterSet();
|
||||
private Pattern pattern;
|
||||
private Pattern examplePattern = Pattern.compile("examples?");
|
||||
|
||||
public void setPattern(String pattern) {
|
||||
this.pattern = Pattern.compile(pattern);
|
||||
}
|
||||
|
||||
public void setExamplePattern(String pattern) {
|
||||
this.examplePattern = Pattern.compile(pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(AuditEvent evt) {
|
||||
return !pattern.matcher(evt.getFileName()).find();
|
||||
if (pattern.matcher(evt.getFileName()).find()) {
|
||||
return false;
|
||||
}
|
||||
if (examplePattern.matcher(evt.getFileName()).find()) {
|
||||
if (evt.getSourceName().endsWith(".JavadocPackageCheck")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user