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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1329423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-04-23 20:19:01 +00:00
parent 71bbc7a7b7
commit dc4f912cfa
5 changed files with 98 additions and 5 deletions

View File

@ -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)

View File

@ -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">

View File

@ -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>

View File

@ -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>

View File

@ -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>