https://github.com/rnveach/checkstyle/commits/javadoc_xdochttps://github.com/checkstyle/checkstyle/compare/master...rnveach:javadoc_xdoc--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------- The Idea
Checkstyle's has documentation of checks and various other things in the xdocs directory and in the code inside the javadocs.
Unfortunately there is nothing to make sure the 2 stay intact and usually results in only one section getting update when changes are made. JavaDocs also vary widely from check to check as some have better documentation than others.
This has been brought up before in GSoC.
https://github.com/checkstyle/checkstyle/wiki/Checkstyle-GSoC-2016-Project-Ideas#project-name-generation-of-web-site-content-for-all-checkstyle-modules-from-javadoc-------- The Problem
The final idea is to build xdocs from javadocs, but we can't just jump there. We have documentation in XDocs that are not in JavaDocs, and JavaDocs that are not in XDocs. I would go as far to say our XDocs are sometimes better than our JavaDocs. So we can't just throw away our current XDocs and rely on bad JavaDocs.
So what can we do?
-------- The First Step Solution
The branch I have made first tries to reconcile the differences between the 2 areas.
It uses a custom Check to grab the current JavaDocs from the checks, and compares them to their respective documentation in the xdocs and asserts that must be the same.
It is not a direct compare since JavaDocs use HTML and custom JavaDoc syntax and XDocs use HTML and custom XDoc syntax. So some conversion is needed. Some documentation is not all in one place for the JavaDocs. The class JavaDoc could contain almost everything from the XDocs while each property and setter may have only a simple paragraph from the XDoc.
-------- Limitations
Since it is a custom check, we have the same limitations as checks do, like it isn't type aware or can only see one file at a time. This may present a issue for abstract classes and would need further investigation.
-------- Input is Needed
Before continuing further, I made an example of this alignment with the check `AbbreviationAsWordInNameCheck`. The changes can be seen in the commit.
I used this check as the base for what the final documentation should look like, while adding some other improvements. This
DOES NOT need to be the final result for all checks. We can customize this however we see fit. I was just using this as an example to demonstrate a solution.
So please feel free to comment on this and describe what format we should use for all our documentation going further. What information should be located in the class JavaDoc, the constructor JavaDoc, the properties/setters JavaDoc.