Comments

Rules intended to catch errors related to code comments

CommentRequired

Since: PMD 5.0

Denotes whether comments are required (or unwanted) for specific language elements.

This rule is defined by the following Java class:net.sourceforge.pmd.lang.java.rule.comments.CommentRequiredRule

Example(s):

/**
* 
*
* @author George Bush
*/

    

This rule has the following properties:

Name Default Value Description
violationSuppressRegex Suppress violations with messages matching a regular expression
violationSuppressXPath Suppress violations on nodes which match a given relative XPath expression.
protectedMethodCommentRequirement Protected method comments
publicMethodCommentRequirement Public method comments
fieldCommentRequirement Field comments
headerCommentRequirement Header comments

CommentSize

Since: PMD 5.0

Determines whether the dimensions of non-header comments found are within the specified limits.

This rule is defined by the following Java class:net.sourceforge.pmd.lang.java.rule.comments.CommentSizeRule

Example(s):

/**
*
*	too many lines!
*
*
*
*
*
*
*
*
*
*
*
*
*/

    

This rule has the following properties:

Name Default Value Description
violationSuppressRegex Suppress violations with messages matching a regular expression
violationSuppressXPath Suppress violations on nodes which match a given relative XPath expression.
maxLines Maximum lines
maxLineLength Maximum line length

CommentContent

Since: PMD 5.0

A rule for the politically correct... we don't want to offend anyone.

This rule is defined by the following Java class:net.sourceforge.pmd.lang.java.rule.comments.CommentContentRule

Example(s):
      
//	OMG, this is horrible, Bob is an idiot !!!
      
  

This rule has the following properties:

Name Default Value Description
violationSuppressRegex Suppress violations with messages matching a regular expression
violationSuppressXPath Suppress violations on nodes which match a given relative XPath expression.
disallowedTerms Illegal terms or phrases
caseSensitive Case sensitive
wordsAreRegex Use regular expressions