Skip to content

Apache Lucene open-source search software

LUCENE-3887: add macro for checking missing javadocs, add some missing package.html javadocs

Robert Muirdc4f912cfa31
diff --git a/dev-tools/scripts/checkJavaDocs.py b/dev-tools/scripts/checkJavaDocs.py
index ae95487c35f..869326348be 100644
--- a/dev-tools/scripts/checkJavaDocs.py
+++ b/dev-tools/scripts/checkJavaDocs.py
@@ -70,11 +70,15 @@ def unescapeHTML(s):
s = s.replace('&', '&')
return s
-def checkPackageSummaries(root):
+def checkPackageSummaries(root, level='class'):
"""
Just checks for blank summary lines in package-summary.html; returns
True if there are problems.
"""
+
+ if level != 'class' and level != 'package':
+ print 'unsupported level: %s, must be "class" or "package"' % level
+ sys.exit(1)
#for dirPath, dirNames, fileNames in os.walk('%s/lucene/build/docs/api' % root):
@@ -94,7 +98,7 @@ def checkPackageSummaries(root):
continue
if 'package-summary.html' in fileNames:
- if checkSummary('%s/package-summary.html' % dirPath):
+ if level != 'package' and checkSummary('%s/package-summary.html' % dirPath):
anyMissing = True
if 'overview-summary.html' in fileNames:
if checkSummary('%s/overview-summary.html' % dirPath):
@@ -103,4 +107,15 @@ def checkPackageSummaries(root):
return anyMissing
if __name__ == '__main__':
- checkPackageSummaries(sys.argv[1])
+ if len(sys.argv) < 2 or len(sys.argv) > 3:
+ print 'usage: %s <dir> [class|package]' % sys.argv[0]
+ sys.exit(1)
+ if len(sys.argv) == 2:
+ level = 'class'
+ else:
+ level = sys.argv[2]
+ if checkPackageSummaries(sys.argv[1], level):
+ print
+ print 'Missing javadocs were found!'
+ sys.exit(1)
+ sys.exit(0)
diff --git a/lucene/build.xml b/lucene/build.xml
index f9aa3133201..1cfbf6fe1d2 100644
--- a/lucene/build.xml
+++ b/lucene/build.xml
@@ -189,9 +189,12 @@
<target name="javadocs" description="Generate javadoc" depends="javadocs-lucene-core, javadocs-modules, javadocs-test-framework"/>
<!-- we check for broken links across all documentation -->
- <!-- TODO: also integrate checkJavaDocs.py, which does more checks -->
<target name="javadocs-lint" depends="documentation">
- <check-broken-links dir="build/docs"/>
+ <sequential>
+ <check-broken-links dir="build/docs"/>
+ <!-- TODO: change this level=class -->
+ <!-- <check-missing-javadocs dir="build/docs" level="package"/> -->
+ </sequential>
</target>
<target name="process-webpages" depends="resolve-pegdown">
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 1a6bc08b5ac..9a534929a27 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -1570,4 +1570,16 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
</sequential>
</macrodef>
+ <macrodef name="check-missing-javadocs">
+ <attribute name="dir"/>
+ <attribute name="level" default="class"/>
+ <sequential>
+ <exec dir="." executable="${python.exe}" failonerror="true">
+ <arg line="${dev-tools.dir}/scripts/checkJavaDocs.py"/>
+ <arg line="@{dir}"/>
+ <arg line="@{level}"/>
+ </exec>
+ </sequential>
+ </macrodef>
+
</project>
diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/package.html b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/package.html
new file mode 100644
index 00000000000..e39d720ae36
--- /dev/null
+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/package.html
@@ -0,0 +1,22 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+<body>
+XML Parser factories for different Lucene Query/Filters.
+</body>
+</html>
diff --git a/lucene/test-framework/src/java/org/apache/lucene/analysis/package.html b/lucene/test-framework/src/java/org/apache/lucene/analysis/package.html
new file mode 100644
index 00000000000..f944c1e814a
--- /dev/null
+++ b/lucene/test-framework/src/java/org/apache/lucene/analysis/package.html
@@ -0,0 +1,41 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body>
+Support for testing analysis components.
+<p>
+The main classes of interest are:
+<ul>
+ <li>{@link org.apache.lucene.analysis.BaseTokenStreamTestCase}: Highly recommended
+ to use its helper methods, (especially in conjunction with
+ {@link org.apache.lucene.analysis.MockAnalyzer} or {@link org.apache.lucene.analysis.MockTokenizer}),
+ as it contains many assertions and checks to catch bugs. </li>
+ <li>{@link org.apache.lucene.analysis.MockTokenizer}: Tokenizer for testing.
+ Tokenizer that serves as a replacement for WHITESPACE, SIMPLE, and KEYWORD
+ tokenizers. If you are writing a component such as a TokenFilter, its a great idea to test
+ it wrapping this tokenizer instead for extra checks. </li>
+ <li>{@link org.apache.lucene.analysis.MockAnalyzer}: Analyzer for testing.
+ Analyzer that uses MockTokenizer for additional verification. If you are testing a custom
+ component such as a queryparser or analyzer-wrapper that consumes analysis streams, its a great
+ idea to test it with this analyzer instead. </li>
+</ul>
+</p>
+</body>