public class JavadocStyleCheck extends AbstractCheck
Validates Javadoc comments to help ensure they are well formed.
The following checks are performed:
{@inheritDoc} tag are exempt from this
requirement.
@param and @return.
These checks were patterned after the checks made by the DocCheck doclet available from Sun. Note: Original Sun's DocCheck tool does not exist anymore.
scope - Specify the visibility scope where Javadoc comments are checked.
Default value is private.
excludeScope - Specify the visibility scope where
Javadoc comments are not checked.
Default value is null.
checkFirstSentence - Control whether to check the first
sentence for proper end of sentence.
Default value is true.
endOfSentenceFormat - Specify the format for matching
the end of a sentence.
Default value is "([.?!][ \t\n\r\f<])|([.?!]$)".
checkEmptyJavadoc - Control whether to check if the Javadoc
is missing a describing text.
Default value is false.
checkHtml - Control whether to check for incomplete HTML tags.
Default value is true.
tokens - tokens to check Default value is:
ANNOTATION_DEF,
ANNOTATION_FIELD_DEF,
CLASS_DEF,
CTOR_DEF,
ENUM_CONSTANT_DEF,
ENUM_DEF,
INTERFACE_DEF,
METHOD_DEF,
PACKAGE_DEF,
VARIABLE_DEF.
To configure the default check:
<module name="JavadocStyle"/>
To configure the check for public scope:
<module name="JavadocStyle"> <property name="scope" value="public"/> </module>
To configure the check for javadoc which is in private, but not in package scope:
<module name="JavadocStyle"> <property name="scope" value="private"/> <property name="excludeScope" value="package"/> </module>
To configure the check to turn off first sentence checking:
<module name="JavadocStyle"> <property name="checkFirstSentence" value="false"/> </module>
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MSG_EMPTY
Message property key for the Unclosed HTML message.
|
static java.lang.String |
MSG_EXTRA_HTML
Message property key for the Extra HTML message.
|
static java.lang.String |
MSG_INCOMPLETE_TAG
Message property key for the Unclosed HTML message.
|
static java.lang.String |
MSG_JAVADOC_MISSING
Message property key for the Unclosed HTML message.
|
static java.lang.String |
MSG_NO_PERIOD
Message property key for the Unclosed HTML message.
|
static java.lang.String |
MSG_UNCLOSED_HTML
Message property key for the Unclosed HTML message.
|
| Constructor and Description |
|---|
JavadocStyleCheck() |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
void |
setCheckEmptyJavadoc(boolean flag)
Setter to control whether to check if the Javadoc is missing a describing text.
|
void |
setCheckFirstSentence(boolean flag)
Setter to control whether to check the first sentence for proper end of sentence.
|
void |
setCheckHtml(boolean flag)
Setter to control whether to check for incomplete HTML tags.
|
void |
setEndOfSentenceFormat(java.util.regex.Pattern pattern)
Setter to specify the format for matching the end of a sentence.
|
void |
setExcludeScope(Scope excludeScope)
Setter to specify the visibility scope where Javadoc comments are not checked.
|
void |
setScope(Scope scope)
Setter to specify the visibility scope where Javadoc comments are checked.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
beginTree, clearMessages, destroy, finishTree, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, log, setFileContents, setTabWidth, setTokensfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic static final java.lang.String MSG_JAVADOC_MISSING
public static final java.lang.String MSG_EMPTY
public static final java.lang.String MSG_NO_PERIOD
public static final java.lang.String MSG_INCOMPLETE_TAG
public static final java.lang.String MSG_UNCLOSED_HTML
public static final java.lang.String MSG_EXTRA_HTML
public JavadocStyleCheck()
public int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypespublic void visitToken(DetailAST ast)
AbstractCheckvisitToken in class AbstractCheckast - the token to processpublic void setScope(Scope scope)
scope - a scope.public void setExcludeScope(Scope excludeScope)
excludeScope - a scope.public void setEndOfSentenceFormat(java.util.regex.Pattern pattern)
pattern - a pattern.public void setCheckFirstSentence(boolean flag)
flag - true if the first sentence is to be checkedpublic void setCheckHtml(boolean flag)
flag - true if HTML checking is to be performed.public void setCheckEmptyJavadoc(boolean flag)
flag - true if empty Javadoc checking should be done.Copyright © 2001-2020. All Rights Reserved.