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>
        

Example:

class Test
{
  // Violation for param "b" and at tags "deprecated", "throws" and "return".
  /**
  * Some summary.
  *
  * <code>@param</code> a Some description
  * <code>@param</code> b
  * <code>@deprecated</code>
  * <code>@throws</code> Exception
  * <code>@return</code>
  */
  public int method(String a, int b) throws Exception {
    return 1;
  }
}
        

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>
        

Example:

class Test
{
  // Violation for param "b" and at tag "throws".
  /**
  * Some summary.
  *
  * <code>@param</code> a Some description
  * <code>@param</code> b
  * <code>@deprecated</code>
  * <code>@throws</code> Exception
  * <code>@return</code>
  */
  public int method(String a, int b) throws Exception {
    return 1;
  }
}
        

Example of Usage

Violation Messages

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

Parent Module

TreeWalker