How to disable checkstyle JavaDoc validation for constructors?
I see that http://checkstyle.sourceforge.net/config_javadoc.html#JavadocMethod states clearly that it "Checks the Javadoc of a method or constructor", however I need to exclude constructors and leave only methods.
Then to disable Checkstyle, you use //CHECKSTYLE:OFF and //CHECKSTYLE:ON (default values) in your code.
Meaning. On line #1, a Javadoc comment is missing. You need a comment for the class itself. Fix. Add a comment at the top of the class.
All you have to do is, while you have a file opened, go to the "Tools" menu, and select "Analyze Javadoc." This opens up an other window that lets you select which methods you would like to generate JavaDoc forms for. Once you select the ones you want to add, click "Fix Selected".
Each Javadoc block begins with a brief summary fragment. This fragment is very important: it is the only part of the text that appears in certain contexts such as class and method indexes. This is a fragment—a noun phrase or verb phrase, not a complete sentence.
In order to ignore constructors, remove the CTOR_DEF
token from the tokens
property, for example:
<module name="JavadocMethod">
<property name="tokens" value="METHOD_DEF,ANNOTATION_FIELD_DEF"/>
</module>
This is achieved by setting tokens
to all the other allowed tokens except CTOR_DEF
. Unfortunately, for this to work, you need to know which tokens to set, and this list varies by Checkstyle version and is not always accurately reflected in the docs. This above example should provide a reasonable setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With