NonEmptyAtclauseDescription
Since Checkstyle 6.0
Description
Checks that the block tag is followed by description.
Properties
name | description | type | default value | since |
---|---|---|---|---|
violateExecutionOnNonTightHtml | Control when to print violations if the Javadoc being examined by this check violates the tight html rules defined at Tight-HTML Rules. | boolean | false |
8.3 |
javadocTokens | javadoc tokens to check | subset of javadoc tokens PARAM_LITERAL , RETURN_LITERAL , THROWS_LITERAL , EXCEPTION_LITERAL , DEPRECATED_LITERAL . | PARAM_LITERAL , RETURN_LITERAL , THROWS_LITERAL , EXCEPTION_LITERAL , DEPRECATED_LITERAL . | 7.3 |
Examples
To configure the default check that will check @param
,
@deprecated
,@throws
,@return
:
<module name="Checker">
<module name="TreeWalker">
<module name="NonEmptyAtclauseDescription"/>
</module>
</module>
Example1:
class Example1 {
/**
* Some summary.
*
* @param a Some description
* @param b
* @deprecated
* @throws Exception
* @return
*/
public void testMethod(){
// violation 6 lines above 'At-clause should have a non-empty description'
// violation 6 lines above 'At-clause should have a non-empty description'
// violation 6 lines above 'At-clause should have a non-empty description'
// violation 6 lines above 'At-clause should have a non-empty description'
}
}
To configure the check to validate @param
,
@throws
tags:
<module name="Checker">
<module name="TreeWalker">
<module name="NonEmptyAtclauseDescription">
<property name="javadocTokens" value="PARAM_LITERAL,THROWS_LITERAL"/>
</module>
</module>
</module>
Example2:
class Example2 {
/**
* Some summary.
*
* @param a Some description
* @param b
* @deprecated
* @throws Exception
* @return
*/
public void testMethod(){
// violation 6 lines above 'At-clause should have a non-empty description'
// @deprecated ignored as not mentioned in javadocTokens
// violation 6 lines above 'At-clause should have a non-empty description'
// @return ignored as not mentioned in javadocTokens
}
}
Example of Usage
Violation Messages
- javadoc.missed.html.close
- javadoc.parse.rule.error
- javadoc.unclosedHtml
- javadoc.wrong.singleton.html.tag
- non.empty.atclause
All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.
Package
com.puppycrawl.tools.checkstyle.checks.javadoc