Class SwitchDensityRule

  • All Implemented Interfaces:
    JavaParserVisitor, net.sourceforge.pmd.lang.rule.ImmutableLanguage, net.sourceforge.pmd.lang.rule.stat.StatisticalRule, net.sourceforge.pmd.properties.PropertySource, net.sourceforge.pmd.Rule

    public class SwitchDensityRule
    extends AbstractStatisticalJavaRule
    Switch Density - This is the number of statements over the number of cases within a switch. The higher the value, the more work each case is doing.

    Its my theory, that when the Switch Density is high, you should start looking at Subclasses or State Pattern to alleviate the problem.

    Author:
    David Dixon-Peugh
    • 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