Locally Disabling Audit Rules

Audit rules can be disabled on a line by line basis by adding a specially formed java comment at the location where the audit rule is to be disabled.  If the comment is at the end of a line of code, then the audit rule will be disabled for that one line.  If the comment is on a line by itself, then the audit rule will be disabled from that point until either it is enabled again or the end of the file. You can disable one or more individual audit rules by specifying either their fully qualified audit identifier or their short audit identifier or disable all audit rules by not specifying any audit identifiers. This behavior can be overridden so that all code is audited using the Ignore disable directives option.

 The general format is

[code] // $codepro.audit.[enable | disable] {<audit rule id>}

Short audit identifiers may be used for any CodePro-provided audit rules. If the fully qualified name of the rule is


the short audit identifier will be "fieldJavadoc". The audit identifier can be found on the Description tab of the audit preference page.

For example:

  • To disable all audit rules for a particular line

    String myVar = 0; // $codepro.audit.disable

  • To disable a single audit rule on one line

    String myVar = 0; // $codepro.audit.disable fieldJavadoc

  • To disable three audit rules for a group of lines

    // $codepro.audit.disable fieldJavadoc, methodJavadoc, typeJavadoc
    String myVar = 0;
    ... more java code ...
    // $codepro.audit.enable

  • To disable all audit rules for an entire file

    // $codepro.audit.disable
    package myPackage;
    ... more java code ... 

  • To disable all audit rules except three for an entire file

    // $codepro.audit.disable
    // $codepro.audit.enable fieldJavadoc, methodJavadoc, typeJavadoc
    package myPackage;
    ... more java code ... 

As an alternative to disabling auditing on a file using disable directives, you can also set up project defaults that will exclude any file based on an exclusion pattern.