Class SingleLineJavadocCheck

All Implemented Interfaces:
Configurable, Contextualizable

public class SingleLineJavadocCheck extends AbstractJavadocCheck

Checks that a Javadoc block can fit in a single line and doesn't contain at-clauses. Javadoc comment that contains at least one at-clause should be formatted in a few lines.

  • Property violateExecutionOnNonTightHtml - Control when to print violations if the Javadoc being examined by this check violates the tight html rules defined at Tight-HTML Rules. Type is boolean. Default value is false.
  • Property ignoredTags - Specify at-clauses which are ignored by the check. Type is java.lang.String[]. Default value is "".
  • Property ignoreInlineTags - Control whether inline tags must be ignored. Type is boolean. Default value is true.

To configure the check:

 <module name="SingleLineJavadoc"/>
 

To configure the check with a list of ignored at-clauses and make inline at-clauses not ignored:

 <module name="SingleLineJavadoc">
   <property name="ignoredTags" value="@inheritDoc, @see"/>
   <property name="ignoreInlineTags" value="false"/>
 </module>
 

Parent is com.puppycrawl.tools.checkstyle.TreeWalker

Violation Message Keys:

  • javadoc.missed.html.close
  • javadoc.parse.rule.error
  • javadoc.wrong.singleton.html.tag
  • singleline.javadoc
Since:
6.0
  • Field Details

    • MSG_KEY

      public static final String MSG_KEY
      A key is pointing to the warning message text in "messages.properties" file.
      See Also:
  • Constructor Details

    • SingleLineJavadocCheck

      public SingleLineJavadocCheck()
  • Method Details

    • setIgnoredTags

      public void setIgnoredTags(String... tags)
      Setter to specify at-clauses which are ignored by the check.
      Parameters:
      tags - to be ignored by check.
    • setIgnoreInlineTags

      public void setIgnoreInlineTags(boolean ignoreInlineTags)
      Setter to control whether inline tags must be ignored.
      Parameters:
      ignoreInlineTags - whether inline tags must be ignored.
    • getDefaultJavadocTokens

      public int[] getDefaultJavadocTokens()
      Description copied from class: AbstractJavadocCheck
      Returns the default javadoc token types a check is interested in.
      Specified by:
      getDefaultJavadocTokens in class AbstractJavadocCheck
      Returns:
      the default javadoc token types
      See Also:
    • getRequiredJavadocTokens

      public int[] getRequiredJavadocTokens()
      Description copied from class: AbstractJavadocCheck
      The javadoc tokens that this check must be registered for.
      Overrides:
      getRequiredJavadocTokens in class AbstractJavadocCheck
      Returns:
      the javadoc token set this must be registered for.
      See Also:
    • visitJavadocToken

      public void visitJavadocToken(DetailNode ast)
      Description copied from class: AbstractJavadocCheck
      Called to process a Javadoc token.
      Specified by:
      visitJavadocToken in class AbstractJavadocCheck
      Parameters:
      ast - the token to process