Optimizing CodeScanner

Below are some ways of optimizing how CodeScanner operates, including:

Commenting out CodeScanner messages

It's possible to tell CodeScanner to ignore specific error or warning messages by inserting specifically formatted comments into source code. This is useful for example, when you have a source line that generates error messages that you know are false and would like to suppress for that single line of code without disabling it elsewhere in the project.

All CodeScanner rules are applicable when commenting out any line of code. The rule names that can be used are listed in the CodeScanner Rules page in the Preferences window. The command to implement a rule suppression looks like this:

codescanner(::<rule_name>)+

And rules to suppress must appear after the C/C++ comment style of "//" or enclosed in "/*" and "*/". For example:

void CTestCase::Foo() {
   RPtrArr *iMember = obj.Array;   // codescanner::pointertoarrays::variablenames
   array->At(a);                   // codescanner::accessArrayElementWithoutCheck
   User::Leave(KErrNone);          /* codescanner::LeaveNoError */
}

Note that multiple rules can be applied to a single line (e.g. RPtrArr as shown above) when prefixed by "::". All rules only apply to the line they are matched with and rules must be contained within that single line.