GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing docs.pmd-code.org — Design | PMD Source Code Analyzer
Release date: 28-December-2026
DesignRules that help you discover design issues.
Table of ContentsAvoidBooleanMethodParametersSince: PMD 7.15.0 Priority: Medium High (2) Boolean parameters in a system’s API can make method calls difficult to understand and maintain. They often indicate that a method is doing more than one thing and could benefit from being split into separate methods with more descriptive names. This rule flags any boolean parameters found in public or global methods, encouraging developers to use more expressive alternatives such as enums, separate methods, or configuration objects. This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.AvoidBooleanMethodParametersRule Example(s): Use this rule by referencing it: AvoidDeeplyNestedIfStmtsSince: PMD 5.5.0 Priority: Medium (3) Avoid creating deeply nested if-then statements since they are harder to read and error-prone to maintain. This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.AvoidDeeplyNestedIfStmtsRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: CognitiveComplexitySince: PMD 6.22.0 Priority: Medium (3) Methods that are highly complex are difficult to read and more costly to maintain. If you include too much decisional logic within a single method, you make its behavior hard to understand and more difficult to modify. Cognitive complexity is a measure of how difficult it is for humans to read and understand a method. Code that contains a break in the control flow is more complex, whereas the use of language shorthands doesn’t increase the level of complexity. Nested control flows can make a method more difficult to understand, with each additional nesting of the control flow leading to an increase in cognitive complexity. Information about Cognitive complexity can be found in the original paper here: https://www.sonarsource.com/docs/CognitiveComplexity.pdf By default, this rule reports methods with a complexity of 15 or more. Reported methods should be broken down into less complex components. This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.CognitiveComplexityRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: CyclomaticComplexitySince: PMD 6.0.0 Priority: Medium (3) The complexity of methods directly affects maintenance costs and readability. Concentrating too much decisional logic in a single method makes its behaviour hard to read and change. Cyclomatic complexity assesses the complexity of a method by counting the number of decision points in a method,
plus one for the method entry. Decision points are places where the control flow jumps to another place in the
program. As such, they include all control flow statements, such as Generally, numbers ranging from 1-4 denote low complexity, 5-7 denote moderate complexity, 8-10 denote high complexity, and 11+ is very high complexity. By default, this rule reports methods with a complexity >= 10. Additionally, classes with many methods of moderate complexity get reported as well once the total of their methods’ complexities reaches 40, even if none of the methods was directly reported. Reported methods should be broken down into several smaller methods. Reported classes should probably be broken down into subcomponents. This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.CyclomaticComplexityRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: ExcessiveClassLengthDeprecated Since: PMD 5.5.0 Priority: Medium (3) Excessive class file lengths are usually indications that the class may be burdened with excessive responsibilities that could be provided by external classes or functions. In breaking these methods apart the code becomes more manageable and ripe for reuse. Deprecated: This rule is deprecated since PMD 7.19.0 and will be removed with PMD 8.0.0. Use This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.ExcessiveClassLengthRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: ExcessiveParameterListSince: PMD 5.5.0 Priority: Medium (3) Methods with numerous parameters are a challenge to maintain, especially if most of them share the same datatype. These situations usually denote the need for new objects to wrap the numerous parameters. This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.ExcessiveParameterListRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: ExcessivePublicCountSince: PMD 5.5.0 Priority: Medium (3) Classes with large numbers of public methods, attributes, and properties require disproportionate testing efforts since combinatorial side effects grow rapidly and increase risk. Refactoring these classes into smaller ones not only increases testability and reliability but also allows new variations to be developed easily. This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.ExcessivePublicCountRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: NcssConstructorCountDeprecated Since: PMD 5.5.0 Priority: Medium (3) This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of lines of code for a given constructor. NCSS ignores comments, and counts actual statements. Using this algorithm, lines of code that are split are counted as one. Deprecated: This rule is deprecated since PMD 7.19.0 and will be removed with PMD 8.0.0. Use This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.NcssConstructorCountRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: NcssCountSince: PMD 7.19.0 Priority: Medium (3) This rule uses the NCSS (Non-Commenting Source Statements) metric to determine the number of lines
of code in a class, method or constructor. NCSS ignores comments, blank lines, and only counts actual
statements. For more details on the calculation, see the documentation
This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.NcssCountRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: NcssMethodCountDeprecated Since: PMD 5.5.0 Priority: Medium (3) This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of lines of code for a given method. NCSS ignores comments, and counts actual statements. Using this algorithm, lines of code that are split are counted as one. Deprecated: This rule is deprecated since PMD 7.19.0 and will be removed with PMD 8.0.0. Use This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.NcssMethodCountRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: NcssTypeCountDeprecated Since: PMD 5.5.0 Priority: Medium (3) This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of lines of code for a given type. NCSS ignores comments, and counts actual statements. Using this algorithm, lines of code that are split are counted as one. Deprecated: This rule is deprecated since PMD 7.19.0 and will be removed with PMD 8.0.0. Use This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.NcssTypeCountRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: StdCyclomaticComplexitySince: PMD 5.5.0 Priority: Medium (3) Complexity directly affects maintenance costs is determined by the number of decision points in a method plus one for the method entry. The decision points include ‘if’, ‘while’, ‘for’, and ‘case labels’ calls. Generally, numbers ranging from 1-4 denote low complexity, 5-7 denote moderate complexity, 8-10 denote high complexity, and 11+ is very high complexity. This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.StdCyclomaticComplexityRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: TooManyFieldsSince: PMD 5.5.0 Priority: Medium (3) Classes that have too many fields can become unwieldy and could be redesigned to have fewer fields, possibly through grouping related fields in new objects. For example, a class with individual city/state/zip fields could park them within a single Address field. This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.TooManyFieldsRule Example(s): This rule has the following properties:
Use this rule with the default properties by just referencing it: Use this rule and customize it: UnusedMethodSince: PMD 7.0.0 Priority: Medium (3) Avoid having unused methods since they make understanding and maintaining code harder. This rule finds not only unused private methods, but public methods as well, as long as the class itself is not entirely unused. A class is considered used, if it contains at least one other method/variable declaration that is used, as shown in the test project file Foo.cls. Apex Language Server is used to make this possible and this needs
additional configuration. The environment variable For an accurate analysis it is important that the If the Apex code references external packages via namespace(s) you should declare these in your This rule is defined by the following Java class: net.sourceforge.pmd.lang.apex.rule.design.UnusedMethodRule Example(s): Use this rule by referencing it: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |