Skip to content

Apache Lucene open-source search software

LUCENE-9713: we don't need those symbol-escape checks. They're valid adoc and we don't produce PDFs.

Dawid Weiss4d0fabf53bd8
diff --git a/gradle/validation/validate-source-patterns.gradle b/gradle/validation/validate-source-patterns.gradle
index ee8952a09fb..d59b5e56412 100644
--- a/gradle/validation/validate-source-patterns.gradle
+++ b/gradle/validation/validate-source-patterns.gradle
@@ -173,17 +173,11 @@ class ValidateSourcePatternsTask extends DefaultTask {
def javaCommentPattern = ~$/(?sm)^\Q/*\E(.*?)\Q*/\E/$;
def xmlCommentPattern = ~$/(?sm)\Q<!--\E(.*?)\Q-->\E/$;
def lineSplitter = ~$/[\r\n]+/$;
- def singleLineSplitter = ~$/\r?\n/$;
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+\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.*/$;
- def blockBoundaryPattern = ~$/----\s*/$;
- def blockTitlePattern = ~$/\..*/$;
- def unescapedSymbolPattern = ~$/(?<=[^\\]|^)([-=]>|<[-=])/$; // SOLR-10883
- def extendsLuceneTestCasePattern = ~$/public.*?class.*?extends.*?LuceneTestCase[^\n]*?\n/$;
def validSPINameJavadocTag = ~$/(?s)\s*\*\s*@lucene\.spi\s+\{@value #NAME\}/$;
def isLicense = { matcher, ratDocument ->
@@ -214,33 +208,6 @@ class ValidateSourcePatternsTask extends DefaultTask {
}
}
- def checkForUnescapedSymbolSubstitutions = { f, text ->
- def inCodeBlock = false;
- def underSourceHeader = false;
- def lineNumber = 0;
- singleLineSplitter.split(text).each {
- ++lineNumber;
- if (underSourceHeader) { // This line is either a single source line, or the boundary of a code block
- inCodeBlock = blockBoundaryPattern.matcher(it).matches();
- if ( ! blockTitlePattern.matcher(it).matches()) {
- underSourceHeader = false;
- }
- } else {
- if (inCodeBlock) {
- inCodeBlock = ! blockBoundaryPattern.matcher(it).matches();
- } else {
- underSourceHeader = sourceHeaderPattern.matcher(it).lookingAt();
- if ( ! underSourceHeader) {
- def unescapedSymbolMatcher = unescapedSymbolPattern.matcher(it);
- if (unescapedSymbolMatcher.find()) {
- reportViolation(f, 'Unescaped symbol "' + unescapedSymbolMatcher.group(1) + '" on line #' + lineNumber);
- }
- }
- }
- }
- }
- }
-
ProgressLogger progress = progressLoggerFactory.newOperation(this.class)
progress.start(this.name, this.name)
@@ -295,9 +262,6 @@ class ValidateSourcePatternsTask extends DefaultTask {
if (f.name.endsWith('.xml')) {
checkLicenseHeaderPrecedes(f, '<tag>', xmlTagPattern, xmlCommentPattern, text, ratDocument);
}
- if (f.name.endsWith('.adoc')) {
- checkForUnescapedSymbolSubstitutions(f, text);
- }
}
progress.completed()