Fork me on GitHub

PMD Rulesets index: Current Rulesets

List of rulesets and rules contained in each ruleset.

  • Code Size: The Code Size ruleset contains rules that find problems related to code size or complexity.
  • Strict Syntax: The Strict Syntax ruleset contains rules that highlight invalid plsql syntax, which works, but should be avoided.

Tom Kyte’s Despair (plsql)

  • TomKytesDespair: “WHEN OTHERS THEN NULL” hides all errors - (Re)RAISE an exception or call RAISE_APPLICATION_ERROR

Code Size (plsql)

  • NPathComplexity: The NPath complexity of a method is the number of acyclic execution paths through that method.A threshold of 200 is generally considered the point where measures should be taken to reduce complexity and increase readability.
  • ExcessiveMethodLength: When methods are excessively long this usually indicates that the method is doing more than itsname/signature might suggest. They also become challenging for others to digest since excessive scrolling causes readers to lose focus.Try to reduce the method length by creating helper methods and removing any copy/pasted code.
  • ExcessiveParameterList: Methods with numerous parameters are a challenge to maintain, especially if most of them share thesame datatype. These situations usually denote the need for new objects to wrap the numerous parameters.
  • ExcessiveObjectLength: Excessive object line lengths are usually indications that the object may be burdened with excessive responsibilities that could be provided by other objects. In breaking these methodsapart the code becomes more managable and ripe for reuse.
  • ExcessiveTypeLength: 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 methodsapart the code becomes more managable and ripe for reuse.
  • ExcessivePackageBodyLength: 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 methodsapart the code becomes more managable and ripe for reuse.
  • ExcessivePackageSpecificationLength: 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 methodsapart the code becomes more managable and ripe for reuse.
  • CyclomaticComplexity: 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 denotehigh complexity, and 11+ is very high complexity.
  • TooManyFields: 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.
  • NcssMethodCount: This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of linesof 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.
  • NcssObjectCount: This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of linesof code for a given Oracle object. NCSS ignores comments, and counts actual statements. Using this algorithm,lines of code that are split are counted as one.
  • TooManyMethods: A package or type with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way tohave more fine grained objects.

PLSQL DATETIME (plsql)

  • TO_DATE_TO_CHAR: TO_DATE(TO_CHAR(date-variable)) used to remove time component - use TRUNC(date-veriable)

Strict Syntax (plsql)