RFR: 8337111: Bad HTML checker for generated documentation
Nizar Benalla
nbenalla at openjdk.org
Mon Nov 4 15:56:31 UTC 2024
Doccheck's human-generated reports are great at previewing a "chessboard" of results. Giving reader a quick glimpse at the quality/health of the documentation. But these tests needed to be automated and they didn't easily translate to something that can be integrated into a CI.
This PR includes an HTML and internal link test on `api/java.base` and a BadChars and Doctype test on the entire generated documentation bundle.
Here is an example of the output after running all tests on `api/java.base`
Note: There is an active PR to fix the broken anchors left in `java.base` so this is not a blocker.
STDOUT:
STDERR:
test: test
Tidy found errors in the generated HTML
/Users/nizarbenalla/Work/jdk-repos/jdk1/build/macosx-aarch64/images/docs/api/java.base/java/lang/Class.html:323:87: Warning: <a> anchor "nest" already defined
Tidy output end.
api/java.base/java/util/concurrent/StructuredTaskScope.ShutdownOnFailure.html:245: id not found: api/java.base/java/util/concurrent/StructuredTaskScope.ShutdownOnFailure.html#TreeStructure
api/java.base/java/util/concurrent/StructuredTaskScope.ShutdownOnSuccess.html:242: id not found: api/java.base/java/util/concurrent/StructuredTaskScope.ShutdownOnSuccess.html#TreeStructure
api/java.base/java/lang/Class.html:323: name already declared: nest
api/java.base/java/lang/Module.html:291: id not found: api/java.base/java/lang/foreign/package-summary.html#restricted
api/java.base/java/lang/Module.html:434: id not found: api/java.base/java/lang/foreign/package-summary.html#restricted
api/java.base/java/lang/foreign/MemorySegment.html:725: id not found: api/java.base/java/lang/foreign/package-summary.html#restricted
Link Checker Report
Checked 3446 files.
Found 445059 references to 48205 anchors in 5770 files and 64 other URIs.
1 duplicate ids
3 missing ids
Hosts
20 docs.oracle.com
1 tools.ietf.org
1 www.ietf.org
1 jcp.org
4 www.rfc-editor.org
7 unicode.org
10 www.unicode.org
20 www.w3.org
Exception running test test: java.lang.Exception: One or more HTML checkers failed: [java.lang.RuntimeException: Tidy found errors in the generated HTML, java.lang.RuntimeException: LinkChecker encountered errors. Duplicate IDs: 1, Missing IDs: 3, Missing Files: 0, Bad Schemes: 0]
java.lang.Exception: One or more HTML checkers failed: [java.lang.RuntimeException: Tidy found errors in the generated HTML, java.lang.RuntimeException: LinkChecker encountered errors. Duplicate IDs: 1, Missing IDs: 3, Missing Files: 0, Bad Schemes: 0]
at DocCheck.runCheckersSequentially(DocCheck.java:181)
at DocCheck.test(DocCheck.java:166)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:573)
at toolbox.TestRunner.runTests(TestRunner.java:91)
at toolbox.TestRunner.runTests(TestRunner.java:73)
at DocCheck.main(DocCheck.java:128)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:573)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1576)
1 errors
java.lang.Exception: 1 errors found
at toolbox.TestRunner.runTests(TestRunner.java:119)
at toolbox.TestRunner.runTests(TestRunner.java:73)
at DocCheck.main(DocCheck.java:128)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:573)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1576)
JavaTest Message: Test threw exception: java.lang.Exception: 1 errors found
JavaTest Message: shutting down test
-------------
Commit messages:
- Convert parts of doccheck into tests
Changes: https://git.openjdk.org/jdk/pull/21879/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21879&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8337111
Stats: 2009 lines in 13 files changed: 2009 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/21879.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/21879/head:pull/21879
PR: https://git.openjdk.org/jdk/pull/21879
More information about the javadoc-dev
mailing list