Class NPathComplexityRule
- java.lang.Object
-
- net.sourceforge.pmd.properties.AbstractPropertySource
-
- net.sourceforge.pmd.lang.rule.AbstractRule
-
- net.sourceforge.pmd.lang.plsql.rule.AbstractPLSQLRule
-
- net.sourceforge.pmd.lang.plsql.rule.AbstractStatisticalPLSQLRule
-
- net.sourceforge.pmd.lang.plsql.rule.design.NPathComplexityRule
-
- All Implemented Interfaces:
PLSQLParserVisitor
,ImmutableLanguage
,StatisticalRule
,PropertySource
,Rule
public class NPathComplexityRule extends AbstractStatisticalPLSQLRule
NPath complexity is a measurement of the acyclic execution paths through a function. See Nejmeh, Communications of the ACM Feb 1988 pp 188-200.- Author:
- Jason Bennett
-
-
Field Summary
-
Fields inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
propertyDescriptors, propertyValuesByDescriptor
-
Fields inherited from interface net.sourceforge.pmd.Rule
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR
-
Fields inherited from interface net.sourceforge.pmd.lang.rule.stat.StatisticalRule
MINIMUM_DESCRIPTOR, SIGMA_DESCRIPTOR, TOP_SCORE_DESCRIPTOR
-
-
Constructor Summary
Constructors Constructor Description NPathComplexityRule()
-
Method Summary
-
Methods inherited from class net.sourceforge.pmd.lang.plsql.rule.AbstractStatisticalPLSQLRule
addDataPoint, apply
-
Methods inherited from class net.sourceforge.pmd.lang.plsql.rule.AbstractPLSQLRule
getDeclaringType, importsPackage, isQualifiedName, 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, 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, deepCopy, deepCopyValuesTo, end, equals, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getParserOptions, getPriority, getPropertySourceType, getRuleChainVisits, getRuleClass, getRuleSetName, getSince, hashCode, isDeprecated, isDfa, isMultifile, isRuleChain, isTypeResolution, setDeprecated, setDescription, setDfa, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setMultifile, setName, setPriority, setRuleClass, setRuleSetName, setSince, setTypeResolution, setUsesDFA, setUsesMultifile, setUsesTypeResolution, start, usesDFA, usesMultifile, usesRuleChain, usesTypeResolution
-
Methods inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, isPropertyOverridden, setProperty, 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.properties.PropertySource
definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, isPropertyOverridden, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
-
Methods inherited from interface net.sourceforge.pmd.Rule
addExample, addRuleChainVisit, addRuleChainVisit, deepCopy, end, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getParserOptions, getPriority, getRuleChainVisits, getRuleClass, getRuleSetName, getSince, isDeprecated, isDfa, isMultifile, isRuleChain, isTypeResolution, setDeprecated, setDescription, setDfa, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setMultifile, setName, setPriority, setRuleClass, setRuleSetName, setSince, setTypeResolution, setUsesDFA, setUsesMultifile, setUsesTypeResolution, start, usesDFA, usesMultifile, usesRuleChain, usesTypeResolution
-
-
-
-
Method Detail
-
visit
public Object visit(ASTMethodDeclaration node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTProgramUnit node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTTypeMethod node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTTriggerUnit node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTTriggerTimingPointSection node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(PLSQLNode node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTIfStatement node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTElsifClause node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTElseClause node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTWhileStatement node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTLoopStatement node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTForStatement node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTReturnStatement node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTCaseWhenClause node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTCaseStatement node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
visit
public Object visit(ASTConditionalOrExpression node, Object data)
- Specified by:
visit
in interfacePLSQLParserVisitor
- Overrides:
visit
in classAbstractPLSQLRule
-
sumExpressionComplexity
public static int sumExpressionComplexity(ASTExpression expr)
Calculate the boolean complexity of the given expression. NPath boolean complexity is the sum of && and || tokens. This is calculated by summing the number of children of the &&'s (minus one) and the children of the ||'s (minus one).Note that this calculation applies to Cyclomatic Complexity as well.
- Parameters:
expr
- control structure expression- Returns:
- complexity of the boolean expression
-
getViolationParameters
public Object[] getViolationParameters(DataPoint point)
- Specified by:
getViolationParameters
in interfaceStatisticalRule
- Overrides:
getViolationParameters
in classAbstractStatisticalPLSQLRule
-
-