mirror of https://github.com/apache/lucene.git
SOLR-12419: standardise solr/contrib (private) logger names
This commit is contained in:
parent
f459bf4397
commit
e1d2749b20
|
@ -66,6 +66,7 @@ def lineSplitter = ~$/[\r\n]+/$;
|
|||
def singleLineSplitter = ~$/\n\r?/$;
|
||||
def licenseMatcher = Defaults.createDefaultMatcher();
|
||||
def validLoggerPattern = ~$/(?s)\b(private\s|static\s|final\s){3}+\s*Logger\s+\p{javaJavaIdentifierStart}+\s+=\s+\QLoggerFactory.getLogger(MethodHandles.lookup().lookupClass());\E/$;
|
||||
def validLoggerNamePattern = ~$/(?s)\b(private\s|static\s|final\s){3}+\s*Logger\s+(log|LOG)+\s+=\s+\QLoggerFactory.getLogger(MethodHandles.lookup().lookupClass());\E/$;
|
||||
def packagePattern = ~$/(?m)^\s*package\s+org\.apache.*;/$;
|
||||
def xmlTagPattern = ~$/(?m)\s*<[a-zA-Z].*/$;
|
||||
def sourceHeaderPattern = ~$/\[source\b.*/$;
|
||||
|
@ -169,6 +170,9 @@ ant.fileScanner{
|
|||
if (!validLoggerPattern.matcher(text).find()) {
|
||||
reportViolation(f, 'invalid logging pattern [not private static final, uses static class name]');
|
||||
}
|
||||
if (f.toString().contains('solr/contrib') && !validLoggerNamePattern.matcher(text).find()) {
|
||||
reportViolation(f, 'invalid logger name [not log or LOG]');
|
||||
}
|
||||
}
|
||||
checkLicenseHeaderPrecedes(f, 'package', packagePattern, javaCommentPattern, text, ratDocument);
|
||||
if (f.name.contains("Test")) {
|
||||
|
|
Loading…
Reference in New Issue