net.sourceforge.pmd.lang.java.rule.comments
Class CommentContentRule

java.lang.Object
  extended by net.sourceforge.pmd.AbstractPropertySource
      extended by net.sourceforge.pmd.lang.rule.AbstractRule
          extended by net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
              extended by net.sourceforge.pmd.lang.java.rule.comments.AbstractCommentRule
                  extended by net.sourceforge.pmd.lang.java.rule.comments.CommentContentRule
All Implemented Interfaces:
JavaParserVisitor, ImmutableLanguage, PropertySource, Rule

public class CommentContentRule
extends AbstractCommentRule

A rule that checks for illegal words in the comment text. TODO implement regex option

Author:
Brian Remedios

Field Summary
static BooleanProperty CASE_SENSITIVE_DESCRIPTOR
           
static StringMultiProperty DISSALLOWED_TERMS_DESCRIPTOR
           
static BooleanProperty WORDS_ARE_REGEX_DESCRIPTOR
           
 
Fields inherited from class net.sourceforge.pmd.AbstractPropertySource
propertyDescriptors, propertyValuesByDescriptor
 
Fields inherited from interface net.sourceforge.pmd.Rule
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR
 
Constructor Summary
CommentContentRule()
           
 
Method Summary
 String dysfunctionReason()
          Returns a description of why the receiver may be dysfunctional.
 void end(RuleContext ctx)
          End processing.
 boolean hasDissallowedTerms()
           
 Set<PropertyDescriptor<?>> ignoredProperties()
          Return the properties that are effectively ignored due to the configuration of the rule and values held by other properties.
 void start(RuleContext ctx)
          Capture values and perform all the case-conversions once per run
 Object visit(ASTCompilationUnit cUnit, Object data)
           
 
Methods inherited from class net.sourceforge.pmd.lang.java.rule.comments.AbstractCommentRule
assignCommentsToDeclarations, filteredCommentIn, orderedCommentsAndDeclarations, tagsIndicesIn
 
Methods inherited from class net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
apply, getDeclaringType, importsPackage, isQualifiedName, isSuppressed, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitAll
 
Methods inherited from class net.sourceforge.pmd.lang.rule.AbstractRule
addExample, addRuleChainVisit, addRuleChainVisit, addViolation, addViolation, addViolation, addViolationWithMessage, addViolationWithMessage, addViolationWithMessage, deepCopyValuesTo, equals, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getParserOptions, getPriority, getRuleChainVisits, getRuleClass, getRuleSetName, getSince, hashCode, isDeprecated, setDeprecated, setDescription, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setName, setPriority, setRuleClass, setRuleSetName, setSince, setUsesDFA, setUsesTypeResolution, usesDFA, usesRuleChain, usesTypeResolution
 
Methods inherited from class net.sourceforge.pmd.AbstractPropertySource
copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, setProperty, useDefaultValueFor, usesDefaultValues
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.pmd.PropertySource
definePropertyDescriptor, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, setProperty, useDefaultValueFor, usesDefaultValues
 

Field Detail

WORDS_ARE_REGEX_DESCRIPTOR

public static final BooleanProperty WORDS_ARE_REGEX_DESCRIPTOR

CASE_SENSITIVE_DESCRIPTOR

public static final BooleanProperty CASE_SENSITIVE_DESCRIPTOR

DISSALLOWED_TERMS_DESCRIPTOR

public static final StringMultiProperty DISSALLOWED_TERMS_DESCRIPTOR
Constructor Detail

CommentContentRule

public CommentContentRule()
Method Detail

start

public void start(RuleContext ctx)
Capture values and perform all the case-conversions once per run

Specified by:
start in interface Rule
Overrides:
start in class AbstractRule
Parameters:
ctx - the rule context
See Also:
Rule.start(RuleContext)

ignoredProperties

public Set<PropertyDescriptor<?>> ignoredProperties()
Description copied from class: AbstractPropertySource
Return the properties that are effectively ignored due to the configuration of the rule and values held by other properties. This can be used to disable corresponding widgets in a UI.

Specified by:
ignoredProperties in interface PropertySource
Overrides:
ignoredProperties in class AbstractPropertySource
Returns:
the properties that are ignored

end

public void end(RuleContext ctx)
Description copied from interface: Rule
End processing. Called once, after apply() is last called.

Specified by:
end in interface Rule
Overrides:
end in class AbstractRule
Parameters:
ctx - the rule context
See Also:
Rule.end(RuleContext)

visit

public Object visit(ASTCompilationUnit cUnit,
                    Object data)
Specified by:
visit in interface JavaParserVisitor
Overrides:
visit in class AbstractJavaRule

hasDissallowedTerms

public boolean hasDissallowedTerms()

dysfunctionReason

public String dysfunctionReason()
Description copied from class: AbstractPropertySource
Returns a description of why the receiver may be dysfunctional. Usually due to missing property values or some kind of conflict between values. Returns null if the receiver is ok.

Specified by:
dysfunctionReason in interface PropertySource
Overrides:
dysfunctionReason in class AbstractPropertySource
Returns:
String
See Also:
PropertySource.dysfunctionReason()


Copyright © 2002–2015 InfoEther. All rights reserved.