Package com.qulice.pmd.rules
Class TooManyFieldsRule
java.lang.Object
net.sourceforge.pmd.properties.AbstractPropertySource
net.sourceforge.pmd.lang.rule.AbstractRule
net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule
com.qulice.pmd.rules.TooManyFieldsRule
- All Implemented Interfaces:
net.sourceforge.pmd.lang.ast.AstVisitor,net.sourceforge.pmd.lang.java.ast.JavaVisitor,net.sourceforge.pmd.lang.rule.Rule,net.sourceforge.pmd.properties.PropertySource
public final class TooManyFieldsRule
extends net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule
Rule to check that a class does not declare too many fields. Like the PMD
built-in
TooManyFields rule, this implementation counts the
fields declared in the body of the class, skipping the static and the
final ones, since those are constants rather than state, and reports a
class that declares more than fifteen of them. Unlike the built-in
rule, it skips a class that extends
org.apache.maven.plugin.AbstractMojo: a Maven Mojo declares one
field per @Parameter it exposes to users of the plugin goal,
because the Maven Plugin API requires each configurable parameter as a
directly annotated field on the Mojo, so that count tracks the number of
options the goal accepts rather than the cohesion of the class.
Skipping them here instead of through a
violationSuppressXPath keeps a redundant
@SuppressWarnings("PMD.TooManyFields") visible to
UnnecessaryWarningSuppression, which PMD credits to the
annotation whenever the annotation suppressor runs first.- Since:
- 1.0
-
Field Summary
Fields inherited from interface net.sourceforge.pmd.lang.rule.Rule
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule
buildTargetSelector, visitJavaNodeMethods inherited from class net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
apply, visitNodeMethods inherited from class net.sourceforge.pmd.lang.rule.AbstractRule
addExample, asCtx, deepCopy, dysfunctionReason, end, equals, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getPriority, getPropertySourceType, getRuleClass, getRuleSetName, getSince, getTargetSelector, hashCode, isDeprecated, setDeprecated, setDescription, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setName, setPriority, setRuleClass, setRuleSetName, setSince, startMethods inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
definePropertyDescriptor, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, isPropertyOverridden, setPropertyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sourceforge.pmd.lang.ast.AstVisitor
cannotVisitMethods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaVisitor
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, visit, visit, visit, visit, visit, visit, visit, visit, visitMethods inherited from interface net.sourceforge.pmd.properties.PropertySource
definePropertyDescriptor, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, isPropertyOverridden, setPropertyMethods inherited from interface net.sourceforge.pmd.lang.rule.Rule
initialize
-
Constructor Details
-
TooManyFieldsRule
public TooManyFieldsRule()Default constructor.
-
-
Method Details
-
visit
-