Best Practices
- TomKytesDespair: "WHEN OTHERS THEN NULL" hides all errors - (Re)RAISE an exception or call RAISE_APPLICATION_ERROR
Code Style
- AvoidTabCharacter: This rule checks, that there are no tab characters (‘\t’) in the source file. It reports only the…
- CodeFormat: This rule verifies that the PLSQL code is properly formatted. The following checks are executed: …
- ForLoopNaming: In case you have loops please name the loop variables more meaningful.
- LineLength: This rule checks for long lines. Please note that comments are not ignored. This rule is the PMD …
- MisplacedPragma: Oracle states that the PRAQMA AUTONOMOUS_TRANSACTION must be in the declaration block, but the co…
Design
- CyclomaticComplexity: Complexity directly affects maintenance costs is determined by the number of decision points in a…
- ExcessiveMethodLength: When methods are excessively long this usually indicates that the method is doing more than its n…
- ExcessiveObjectLength: Excessive object line lengths are usually indications that the object may be burdened with excess…
- ExcessivePackageBodyLength: Excessive class file lengths are usually indications that the class may be burdened with excessiv…
- ExcessivePackageSpecificationLength: Excessive class file lengths are usually indications that the class may be burdened with excessiv…
- ExcessiveParameterList: Methods with numerous parameters are a challenge to maintain, especially if most of them share th…
- ExcessiveTypeLength: Excessive class file lengths are usually indications that the class may be burdened with excessiv…
- NcssMethodCount: This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of l…
- NcssObjectCount: This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of l…
- NPathComplexity: The NPath complexity of a method is the number of acyclic execution paths through that method. A …
- TooManyFields: Classes that have too many fields can become unwieldy and could be redesigned to have fewer field…
- TooManyMethods: A package or type with too many methods is probably a good suspect for refactoring, in order to r…
Error Prone
- TO_DATE_TO_CHAR: TO_DATE(TO_CHAR(date-variable)) used to remove time component - use TRUNC(date-variable)
- TO_DATEWithoutDateFormat: TO_DATE without date format- use TO_DATE(expression, date-format)
- TO_TIMESTAMPWithoutDateFormat: TO_TIMESTAMP without date format- use TO_TIMESTAMP(expression, date-format)
Additional rulesets
-
Code Size (
rulesets/plsql/codesize.xml
):Deprecated This ruleset is for backwards compatibility.
It contains the following rules:
CyclomaticComplexity, ExcessiveMethodLength, ExcessiveObjectLength, ExcessivePackageBodyLength, ExcessivePackageSpecificationLength, ExcessiveParameterList, ExcessiveTypeLength, NcssMethodCount, NcssObjectCount, NPathComplexity, TooManyFields, TooManyMethods
-
PLSQL DATETIME (
rulesets/plsql/dates.xml
):Deprecated This ruleset is for backwards compatibility.
It contains the following rules:
TO_DATE_TO_CHAR, TO_DATEWithoutDateFormat, TO_TIMESTAMPWithoutDateFormat
-
Strict Syntax (
rulesets/plsql/strictsyntax.xml
):Deprecated This ruleset is for backwards compatibility.
It contains the following rules:
-
Tom Kyte’s Despair (
rulesets/plsql/TomKytesDespair.xml
):Deprecated This ruleset is for backwards compatibility.
It contains the following rules: