CodeScanner Rules preferences

Use the CodeScanner Rules page in the Preferences window or the project's properties window to enable or disable the rules used to validate Symbian OS project files. Rules are divided by category and have a severity assigned to them by CodeScanner, but you can use the Edit control to change those settings to better suit your work environment. You can also sort the rules by clicking a column title.

Figure 1. Rules global settings

NameFunction
Configure Project Specific Settings...

Click to open the project Properties window and configure CodeScanner for that specific project.

NOTE Only visible in the global CodeScanner preference panels. This also applies to the File Filters and General pages

CodeScanner rules

The list of all CodeScanner rules and their active state.

Edit... Opens the currently selected rule in the edit rule dialog where you can set the categroy and severity of the rule.
Enable All Activates all the rules in the CodeScanner rules list.
Disable All Deactivates all the rules in the CodeScanner rules list.
Details Displays helpful advice to help you avoid triggering the selected rule in your source code and projects.

 

The following table indicates an example of rules listed in the Rules tab and associated error messages that would be generated in the Problems view.

Name Description

accessArrayElementWithoutCheck

Array element accessed by At() function without checking index is within array range

accessArrayElementWithoutCheck2

Array element accessed by [] without checking range

activestart

Using CActiveScheduler::Start

activestop

Using CActiveScheduler::Stop

arraypassing

Passing arrays by value rather than reference

arrayptrcleanup

Using local CArrayPtr classes without cleanup items

assertdebuginvariant

__ASSERT_DEBUG with User::Invariant

baddefines

Lowercase definition names

baseconstruct

Leaving function called before BaseConstructL()

callActiveObjectWithoutCheckingOrStopping

Active object called without checking whether it is active or canceling it first

changenotification

Using RSAVarChangeNotify to see System Agent changes

cleanup

CleanupStack::Pop(AndDestroy) parameters

commentcode

Commented-out code

connect

Ignoring Connect() return value

ConnectAndDontCloseMemberVariable

Calling Connect() or Open() on a member variable without calling Close() in the destructor

constnames

Badly-named constants

consttdescptr

Const descriptor pointer as argument

controlornull

Accessing return value of ControlOrNull()

ctltargettype

Use of targettype ctl

debugrom

Debug components in ROM

declarename

Use of __DECLARE_NAME

deleteMemberVariable

Member variable deleted incorrectly

destructor

Pointer access in destructors

doubleSemiColon

Use of double semicolon

driveletters

Hard-coded drive letters

eikbuttons

Checks that the R_EIK_BUTTONS_* resources are not being used

eikonenvstatic

Using CEikonEnv::Static

enummembers

Enums with badly-named members

enumnames

Badly-named enums

exportinline

Exporting inline functions

exportpurevirtual

Exporting pure virtual functions

externaldriveletters

Hard-coded external drive letters

foff

Use of _FOFF

forbiddenwords

Use of forbidden words in header files

forgottoputptroncleanupstack

Neglected to put variable on cleanup stack

friend

Use of friends

goto

Use of goto

ifassignments

Assignment in an If statement

ifpreprocessor

Use of #if in .h files

inheritanceorder

Incorrect inheritance order of M and C classes

intleaves

Methods that leave AND return a TInt error

jmp

Use of setjmp and/or longjmp

leave

Leaving functions called in non-leaving functions

LeaveNoError

Leaving with KErrNone

leavingoperators

Leaving functions called in operator functions

LFunctionCantLeave

L-functions that cannot leave

longlines

Overly long lines of code

magicnumbers

Use of magic numbers

mclassdestructor

M class has destructor

memberlc

Assigning LC methods to member variables

membervariablecallld

Calling LD function on member variable

missingcancel

Cancel() not called in active object's destructor

missingcclass

C class not inheriting from another C class

mmpsourcepath

Use of absolute path names in MMP files

multilangrsc

Not using BaflUtils::NearestLanguageFile() when loading a resource file

multipledeclarations

Multiple declarations on one line

multipleinheritance

Non M-class multiple inheritance

mydocs

Hard-coded mydocs directory strings

namespace

Use of namespace

newlreferences

NewL() returning a reference

noleavetrap

TRAP used with no leaving functions

nonconsthbufc

Non-const HBufC* parameter passing

nonconsttdesc

Non-const TDesC& parameter passing

nonleavenew

Use of new without (ELeave)

nonunicodeskins

Non-Unicode skins

null

NULL equality check

open

Ignoring Open() return value

pointertoarrays

Pointer to arrays as members of a C class

pragmadisable

Use of #pragma warning

pragmamessage

Use of #pragma message

pragmaother

Use of #pragma other than warning and message

privateinheritance

Use of private inheritance

pushaddrvar

Pushing address of a variable onto the cleanup stack

pushmember

Pushing data members onto the cleanup stack

readresource

Using ReadResource() instead of ReadResourceL()

resourcenotoncleanupstack

Neglected to put resource objects on cleanup stack

resourcesonheap

Resource objects on the heap

returndescriptoroutofscope

Return descriptor out of scope

rfs

Use of non-pointer/reference RFs

rssnames

Duplicate RSS names

stringliterals

Use of _L string literals

stringsinresourcefiles

Strings in RSS or RA files

struct

Use of struct

tcclasses

T classes inheriting from C classes

tclassdestructor

T class has destructor

todocomments

"To do” comments

trapcleanup

Use of LC function in TRAPs

trapeleave

Trapping new(ELeave)

traprunl

Trapping of (Do)RunL() rather than using RunError()

trspassing

Passing TRequestStatus parameters by value

uids

Duplicate UIDs

uncompressedaif

Uncompressed AIFs in ROM

uncompressedbmp

Uncompressed bitmaps in ROM

unicodesource

Unicode source files

userafter

Use of User::After

userfree

Using User::Free directly

userWaitForRequest

Use of User::WaitForRequest

variablenames

Local variables with member/argument names

voidparameter

Void parameter explicitly declared

worryingcomments

Worrying comments

 

CodeScanner for projects

CodeScanner options can also be set at the project level in the Properties window. Right-click the project and choose Properties, then select the Carbide.c++ > Carbide CodeScanner element in the properties list. Click a tab to view the appropriate page and set its options.

CodeScanner options specific to the project:

Name Description
Enable Project Specific Settings Activate to set project specific CodeScanner settings. By default a project in the workspace uses the global CodeScanner settings unless this option is activated.
Configure Workspace Settings...

Click to open the Preferences window and configure CodeScanner for the workspace.

NOTE Only visible in the project CodeScanner property panels.

 

Other references