# HG changeset patch # User fturovic # Date 1238772960 18000 # Node ID 131ddbe8aee42755ece5910531a54b2f6cc8e514 # Parent 76b35ebe58d6cabb697507065b616d8f2fc36619 added IAD rules to CS manual diff -r 76b35ebe58d6 -r 131ddbe8aee4 core/com.nokia.carbide.cpp.codescanner/html/customizing_cs.htm --- a/core/com.nokia.carbide.cpp.codescanner/html/customizing_cs.htm Thu Apr 02 16:53:08 2009 -0500 +++ b/core/com.nokia.carbide.cpp.codescanner/html/customizing_cs.htm Fri Apr 03 10:36:00 2009 -0500 @@ -1,294 +1,299 @@ - -Customizing CodeScanner Rules - - - - -
-

Customizing CodeScanner Rules

-
-

The CodeScanner command line tool currently accepts an XML configuration file, which controls scanning behavior, like the file types to ignore and which rules to apply. Using the elements contained here makes it possible to customize the scanning rules to include new rules unique to your development environment.

-

This page describes the format of CodeScanner config file (codescannerconfig.xml), which is used for the following purposes:

- -

CODESCANNERCONFIG.XML File

-

The CodeScanner config file is an XML formatted file created by CodeScanner when a scan is performed or when the CodeScaner preference settings are exported. The file contains the following elements:

- -

Arguments Element

-

Each Arguments element contains one or more of the following arguments:

- -

An example of an Arguments element:

-

<arguments>
-     <input>C:\Symbian\9.2\Epoc32\include</input>
-     <input>C:\CodeScanner_Tests\includes</input>
-     <lxr>http://s60lxr/source/</lxr>
-     - <lxrversion>S60_3_2_200736</lxrversion>
-     <outputformat>html|std</outputformat>
-     <timestampedoutput>on</timestampedoutput>
- </arguments>

-

Sources Element

-

Each Sources element can contain one or more Excludes elements.

- -

An example of a Sources element:

-

<sources>
-     <exclude>.*\.avi</exclude>
-     <exclude>.*\.bmp</exclude>
-     <exclude>.*\.jpg</exclude>
-     <exclude>.*\\test\\.*</exclude>
- </sources>

-

Scripts Element

-

Each Scripts element can contain one or more Script elements, each of which corresponds to a CodeScanner script (each script applies a CodeScanner rule):

- -

Complete list of currently supported Script elements with default attributes:

-

<scripts>
-
-<accessArrayElementWithoutCheck category="codereview" enable="true" severity="low"/>
-<accessArrayElementWithoutCheck2 category="codereview" enable="true" severity="low"/>
-<activestart category="codereview" enable="true" severity="low"/>
-<activestop category="codereview" enable="true" severity="low"/>
-<arraypassing category="performance" enable="true" severity="medium"/>
-<arrayptrcleanup category="codereview" enable="true" severity="low"/>
-<assertdebuginvariant category="codingstandards" enable="true" severity="low"/>
-
-<baddefines category="codingstandards" enable="true" severity="low"/>
-<baseconstruct category="codereview" enable="true" severity="low"/>
-
-<callActiveObjectWithoutCheckingOrStopping category="codereview" enable="true" severity="low"/> <changenotification category="codereview" enable="true" severity="low"/>
-<cleanup category="codingstandards" enable="true" severity="low"/>
-<commentcode category="codereview" enable="true" severity="low"/>
-<connect category="canpanic" enable="true" severity="high"/>
-<ConnectAndDontCloseMemberVariable category="functionality" enable="true" severity="medium"/> <constnames category="codingstandards" enable="true" severity="low"/>
-<consttdescptr category="codingstandards" enable="true" severity="low"/>
-<controlornull category="canpanic" enable="true" severity="high"/>
-<ctltargettype category="functionality" enable="true" severity="medium"/>
-
-<debugrom category="performance" enable="true" severity="medium"/>
-<declarename category="codingstandards" enable="true" severity="low"/>
-<deleteMemberVariable category="canpanic" enable="true" severity="high"/>
-<destructor category="canpanic" enable="true" severity="high"/>
-<doubleSemiColon category="codereview" enable="true" severity="low"/>
-<driveletters category="codingstandards" enable="true" severity="low"/>
-
-<eikbuttons category="localisation" enable="true" severity="medium"/>
-<eikonenvstatic category="performance" enable="true" severity="medium"/>
-<enummembers category="codingstandards" enable="true" severity="low"/>
-<enumnames category="codingstandards" enable="true" severity="low"/>
-<exportinline category="functionality" enable="true" severity="medium"/>
-<exportpurevirtual category="functionality" enable="true" severity="medium"/>
-
-<foff category="codereview" enable="true" severity="low"/>
-<forbiddenwords category="codingstandards" enable="true" severity="low">
-    <wordsRE>Epoc|Nokia Mobile Phones|NMP|(^|\s)S60</wordsRE>
-</forbiddenwords>
-<forgottoputptroncleanupstack category="codereview" enable="true" severity="low"/>
-<friend category="codereview" enable="true" severity="low"/>
-
-<goto category="codingstandards" enable="true" severity="low"/>
-
-<ifassignments category="codingstandards" enable="true" severity="low"/>
-<ifpreprocessor category="codingstandards" enable="true" severity="low"/>
-<inheritanceorder category="canpanic" enable="true" severity="high"/>
-<intleaves category="codereview" enable="true" severity="low"/>
-
-<jmp category="codingstandards" enable="true" severity="low"/>
-
-<leave category="canpanic" enable="true" severity="high"/>
-<LeaveNoError category="functionality" enable="true" severity="medium"/>
-<leavingoperators category="codereview" enable="true" severity="low"/>
-<LFunctionCantLeave category="codereview" enable="true" severity="low"> <LFunctionIgnoreRE>RunL</LFunctionIgnoreRE> </LFunctionCantLeave>
-<longlines category="codingstandards" enable="true" length="160" severity="low"/>
-
-<magicnumbers category="codingstandards" enable="true" severity="low"/>
-<mclassdestructor category="codingstandards" enable="true" severity="low"/>
-<memberlc category="canpanic" enable="true" severity="high"/>
-<membervariablecallld category="codingstandards" enable="true" severity="low"/>
-<missingcancel category="codingstandards" enable="true" severity="low"/>
-<missingcclass category="canpanic" enable="true" severity="high">     <cclassIgnoreRE>CBase</cclassIgnoreRE>
-</missingcclass>
-<mmpsourcepath category="codingstandards" enable="true" severity="low"/>
-<multilangrsc category="codereview" enable="true" severity="low"/>
-<multipledeclarations category="codingstandards" enable="true" severity="low"/>
-<multipleinheritance category="functionality" enable="true" severity="medium"/>
-<mydocs category="functionality" enable="true" severity="medium"/>
-
-<namespace category="codingstandards" enable="true" severity="low"/>
-<newlreferences category="codingstandards" enable="true" severity="low"/>
-<noleavetrap category="codereview" enable="true" severity="low"/>
-<nonconsthbufc category="codingstandards" enable="true" severity="low"/>
-<nonconsttdesc category="codingstandards" enable="true" severity="low"/>
-<nonleavenew category="codereview" enable="true" severity="low"/>
-<nonunicodeskins category="codereview" enable="true" severity="low"/>
-<null category="codingstandards" enable="true" severity="low"/>
-
-<open category="canpanic" enable="true" severity="high">     <openIgnoreRE>RDesReadStream|RDesWriteStream</openIgnoreRE>
-</open>
-
-<pointertoarrays category="performance" enable="true" severity="medium"/>
-<pragmadisable category="codingstandards" enable="true" severity="low"/>
-<pragmamessage category="codingstandards" enable="true" severity="low"/>
-<pragmaother category="codereview" enable="true" severity="low"/>
-<privateinheritance category="codingstandards" enable="true" severity="low"/>
-<pushaddrvar category="canpanic" enable="true" severity="high"/>
-<pushmember category="canpanic" enable="true" severity="high"/>
-
-<readresource category="canpanic" enable="true" severity="high"/>
-<resourcenotoncleanupstack category="codereview" enable="true" severity="low"/>
-<resourcesonheap category="codingstandards" enable="true" severity="low"/> <returndescriptoroutofscope category="canpanic" enable="true" severity="high"/>
-<rfs category="codereview" enable="true" severity="low"/>
-<rssnames category="codereview" enable="true" severity="low"/>
-
-<stringliterals category="codingstandards" enable="true" severity="low"/>
-<stringsinresourcefiles category="codereview" enable="true" severity="low"/>
-<struct category="codingstandards" enable="true" severity="low"/>
-
-<tcclasses category="functionality" enable="true" severity="medium"/>
-<tclassdestructor category="codingstandards" enable="true" severity="low"/>
-<todocomments category="codereview" enable="true" severity="low"/>
-<trapcleanup category="panic" enable="true" severity="high"/>
-<trapeleave category="performance" enable="true" severity="medium"/>
-<traprunl category="codingstandards" enable="true" severity="low"/>
-<trspassing category="functionality" enable="true" severity="medium"/>
-
-<uids category="codereview" enable="true" severity="low"/>
-<uncompressedaif category="performance" enable="true" severity="medium"/>
-<uncompressedbmp category="performance" enable="true" severity="medium"/>
-<unicodesource category="codereview" enable="true" severity="low"/>
-<userafter category="performance" enable="true" severity="medium"/>
-<userfree category="codereview" enable="true" severity="low"/>
-<userWaitForRequest category="codereview" enable="true" severity="low"/>
-
-<variablenames category="codingstandards" enable="true" severity="low"/>
-<voidparameter category="codingstandards" enable="true" severity="low"/>
-
-<worryingcomments category="codereview" enable="true" severity="low">     <worryRE>\!|\?|[Zz]{3}|kludge|workaround|\scrap|hack</worryRE>
-</worryingcomments>
-
-</scripts>

-

Severities Element

-

Each Severities element can contain one or more Severity elements, each of which corresponds to a severity level:

- -

Complete list of currently supported Severity elements:

-

<severities>
-     <high enable=”true”/>
-     - <medium enable=”true”/>
-     <low enable=”false”/>
- </severities>

-

Categories Element

-

Each Categories element can contain one or more Category elements, each of which corresponds to a category of CodeScanner scripts:

- -

Complete list of currently supported Category elements:

-

<categories>
-     <legal enable="true"/>
-     <panic enable=”true”>
-     <canpanic enable="true"/>
-     <functionality enable=”true”/>
-     <localisation enable="true"/>
-     <performance enable=”true”>
-     <codingstandards enable="true"/>
-     <documentation enable=”false”/>
-     <codereview enable=”false”/>
-     <other enable="true"/>
- </categories>

-

Customrules Element

-

Each custom rules element can contain one or more custom rule elements, each of which defines a custom rule to be applied by CodeScanner during scanning operation:

- -

Each custom rule element contains the following elements:

- -

An example of CustomRules element:

-

<customrules>
-     <customrule>
-         <name>myOwnRule</name>
-         <keyword type=”class”>CMyOwnClass</keyword>
-         <filetype>h</filetype>
-         <severity>low</severity>
-         <title>My own little CodeScanner rule</title>
-         <description>Locate the definition of CMyOwnClass::MyFunction()</description>
-         <link>http://www.myownsite.nokia.com</link>
-     </customrule>
- </customrules>

- - - + +Customizing CodeScanner Rules + + + + +
+

Customizing CodeScanner Rules

+
+

The CodeScanner command line tool currently accepts an XML configuration file, which controls scanning behavior, like the file types to ignore and which rules to apply. Using the elements contained here makes it possible to customize the scanning rules to include new rules unique to your development environment.

+

This page describes the format of CodeScanner config file (codescannerconfig.xml), which is used for the following purposes:

+ +

CODESCANNERCONFIG.XML File

+

The CodeScanner config file is an XML formatted file created by CodeScanner when a scan is performed or when the CodeScaner preference settings are exported. The file contains the following elements:

+ +

Arguments Element

+

Each Arguments element contains one or more of the following arguments:

+ +

An example of an Arguments element:

+

<arguments>
+     <input>C:\Symbian\9.2\Epoc32\include</input>
+     <input>C:\CodeScanner_Tests\includes</input>
+     <lxr>http://s60lxr/source/</lxr>
+     + <lxrversion>S60_3_2_200736</lxrversion>
+     <outputformat>html|std</outputformat>
+     <timestampedoutput>on</timestampedoutput>
+ </arguments>

+

Sources Element

+

Each Sources element can contain one or more Excludes elements.

+ +

An example of a Sources element:

+

<sources>
+     <exclude>.*\.avi</exclude>
+     <exclude>.*\.bmp</exclude>
+     <exclude>.*\.jpg</exclude>
+     <exclude>.*\\test\\.*</exclude>
+ </sources>

+

Scripts Element

+

Each Scripts element can contain one or more Script elements, each of which corresponds to a CodeScanner script (each script applies a CodeScanner rule):

+ +

Complete list of currently supported Script elements with default attributes:

+

<scripts>
+
+<accessArrayElementWithoutCheck category="codereview" enable="true" severity="low"/>
+<accessArrayElementWithoutCheck2 category="codereview" enable="true" severity="low"/>
+<activestart category="codereview" enable="true" severity="low"/>
+<activestop category="codereview" enable="true" severity="low"/>
+<arraypassing category="performance" enable="true" severity="medium"/>
+<arrayptrcleanup category="codereview" enable="true" severity="low"/>
+<assertdebuginvariant category="codingstandards" enable="true" severity="low"/>
+
+<baddefines category="codingstandards" enable="true" severity="low"/>
+<baseconstruct category="codereview" enable="true" severity="low"/>
+
+<callActiveObjectWithoutCheckingOrStopping category="codereview" enable="true" severity="low"/> <changenotification category="codereview" enable="true" severity="low"/>
+<cleanup category="codingstandards" enable="true" severity="low"/>
+<commentcode category="codereview" enable="true" severity="low"/>
+<connect category="canpanic" enable="true" severity="high"/>
+<ConnectAndDontCloseMemberVariable category="functionality" enable="true" severity="medium"/> <constnames category="codingstandards" enable="true" severity="low"/>
+<consttdescptr category="codingstandards" enable="true" severity="low"/>
+<controlornull category="canpanic" enable="true" severity="high"/>
+<crepository category="other" enable="true" severity="low"/>
+<ctltargettype category="functionality" enable="true" severity="medium"/>
+<customizableicons category="other" enable="true" severity="low">
+     <iconsRE>iconA.bmp|iconB.svg|iconC</iconsRE>
+ </customizableicons>
+
+<debugrom category="performance" enable="true" severity="medium"/>
+<declarename category="codingstandards" enable="true" severity="low"/>
+<deleteMemberVariable category="canpanic" enable="true" severity="high"/>
+<destructor category="canpanic" enable="true" severity="high"/>
+<doubleSemiColon category="codereview" enable="true" severity="low"/>
+<driveletters category="codingstandards" enable="true" severity="low"/>
+
+<eikbuttons category="localisation" enable="true" severity="medium"/>
+<eikonenvstatic category="performance" enable="true" severity="medium"/>
+<enummembers category="codingstandards" enable="true" severity="low"/>
+<enumnames category="codingstandards" enable="true" severity="low"/>
+<exportinline category="functionality" enable="true" severity="medium"/>
+<exportpurevirtual category="functionality" enable="true" severity="medium"/>
+
+<flags category="other" enable="true" severity="low"/>
+<foff category="codereview" enable="true" severity="low"/>
+<forbiddenwords category="codingstandards" enable="true" severity="low">
+    <wordsRE>Epoc|Nokia Mobile Phones|NMP|(^|\s)S60</wordsRE>
+</forbiddenwords>
+<forgottoputptroncleanupstack category="codereview" enable="true" severity="low"/>
+<friend category="codereview" enable="true" severity="low"/>
+
+<goto category="codingstandards" enable="true" severity="low"/>
+
+<ifassignments category="codingstandards" enable="true" severity="low"/>
+<ifpreprocessor category="codingstandards" enable="true" severity="low"/>
+<inheritanceorder category="canpanic" enable="true" severity="high"/>
+<intleaves category="codereview" enable="true" severity="low"/>
+
+<jmp category="codingstandards" enable="true" severity="low"/>
+
+<leave category="canpanic" enable="true" severity="high"/>
+<LeaveNoError category="functionality" enable="true" severity="medium"/>
+<leavingoperators category="codereview" enable="true" severity="low"/>
+<LFunctionCantLeave category="codereview" enable="true" severity="low"> <LFunctionIgnoreRE>RunL</LFunctionIgnoreRE> </LFunctionCantLeave>
+<longlines category="codingstandards" enable="true" length="160" severity="low"/>
+
+<magicnumbers category="codingstandards" enable="true" severity="low"/>
+<mclassdestructor category="codingstandards" enable="true" severity="low"/>
+<memberlc category="canpanic" enable="true" severity="high"/>
+<membervariablecallld category="codingstandards" enable="true" severity="low"/>
+<missingcancel category="codingstandards" enable="true" severity="low"/>
+<missingcclass category="canpanic" enable="true" severity="high">     <cclassIgnoreRE>CBase</cclassIgnoreRE>
+</missingcclass>
+<mmpsourcepath category="codingstandards" enable="true" severity="low"/>
+<multilangrsc category="codereview" enable="true" severity="low"/>
+<multipledeclarations category="codingstandards" enable="true" severity="low"/>
+<multipleinheritance category="functionality" enable="true" severity="medium"/>
+<mydocs category="functionality" enable="true" severity="medium"/>
+
+<namespace category="codingstandards" enable="true" severity="low"/>
+<newlreferences category="codingstandards" enable="true" severity="low"/>
+<noleavetrap category="codereview" enable="true" severity="low"/>
+<nonconsthbufc category="codingstandards" enable="true" severity="low"/>
+<nonconsttdesc category="codingstandards" enable="true" severity="low"/>
+<nonleavenew category="codereview" enable="true" severity="low"/>
+<nonunicodeskins category="codereview" enable="true" severity="low"/>
+<null category="codingstandards" enable="true" severity="low"/>
+
+<open category="canpanic" enable="true" severity="high">     <openIgnoreRE>RDesReadStream|RDesWriteStream</openIgnoreRE>
+</open>
+
+<pointertoarrays category="performance" enable="true" severity="medium"/>
+<pragmadisable category="codingstandards" enable="true" severity="low"/>
+<pragmamessage category="codingstandards" enable="true" severity="low"/>
+<pragmaother category="codereview" enable="true" severity="low"/>
+<privateinheritance category="codingstandards" enable="true" severity="low"/>
+<pushaddrvar category="canpanic" enable="true" severity="high"/>
+<pushmember category="canpanic" enable="true" severity="high"/>
+
+<readresource category="canpanic" enable="true" severity="high"/>
+<resourcenotoncleanupstack category="codereview" enable="true" severity="low"/>
+<resourcesonheap category="codingstandards" enable="true" severity="low"/> <returndescriptoroutofscope category="canpanic" enable="true" severity="high"/>
+<rfs category="codereview" enable="true" severity="low"/>
+<rssnames category="codereview" enable="true" severity="low"/>
+
+<stringliterals category="codingstandards" enable="true" severity="low"/>
+<stringsinresourcefiles category="codereview" enable="true" severity="low"/>
+<struct category="codingstandards" enable="true" severity="low"/>
+
+<tcclasses category="functionality" enable="true" severity="medium"/>
+<tclassdestructor category="codingstandards" enable="true" severity="low"/>
+<todocomments category="codereview" enable="true" severity="low"/>
+<trapcleanup category="panic" enable="true" severity="high"/>
+<trapeleave category="performance" enable="true" severity="medium"/>
+<traprunl category="codingstandards" enable="true" severity="low"/>
+<trspassing category="functionality" enable="true" severity="medium"/>
+
+<uids category="codereview" enable="true" severity="low"/>
+<uncompressedaif category="performance" enable="true" severity="medium"/>
+<uncompressedbmp category="performance" enable="true" severity="medium"/>
+<unicodesource category="codereview" enable="true" severity="low"/>
+<userafter category="performance" enable="true" severity="medium"/>
+<userfree category="codereview" enable="true" severity="low"/>
+<userWaitForRequest category="codereview" enable="true" severity="low"/>
+
+<variablenames category="codingstandards" enable="true" severity="low"/>
+<voidparameter category="codingstandards" enable="true" severity="low"/>
+
+<worryingcomments category="codereview" enable="true" severity="low">     <worryRE>\!|\?|[Zz]{3}|kludge|workaround|\scrap|hack</worryRE>
+</worryingcomments>
+
+ </scripts>

+

Severities Element

+

Each Severities element can contain one or more Severity elements, each of which corresponds to a severity level:

+ +

Complete list of currently supported Severity elements:

+

<severities>
+     <high enable=”true”/>
+     + <medium enable=”true”/>
+     <low enable=”false”/>
+ </severities>

+

Categories Element

+

Each Categories element can contain one or more Category elements, each of which corresponds to a category of CodeScanner scripts:

+ +

Complete list of currently supported Category elements:

+

<categories>
+     <legal enable="true"/>
+     <panic enable=”true”>
+     <canpanic enable="true"/>
+     <functionality enable=”true”/>
+     <localisation enable="true"/>
+     <performance enable=”true”>
+     <codingstandards enable="true"/>
+     <documentation enable=”false”/>
+     <codereview enable=”false”/>
+     <other enable="true"/>
+ </categories>

+

Customrules Element

+

Each custom rules element can contain one or more custom rule elements, each of which defines a custom rule to be applied by CodeScanner during scanning operation:

+ +

Each custom rule element contains the following elements:

+ +

An example of CustomRules element:

+

<customrules>
+     <customrule>
+         <name>myOwnRule</name>
+         <keyword type=”class”>CMyOwnClass</keyword>
+         <filetype>h</filetype>
+         <severity>low</severity>
+         <title>My own little CodeScanner rule</title>
+         <description>Locate the definition of CMyOwnClass::MyFunction()</description>
+         <link>http://www.myownsite.nokia.com</link>
+     </customrule>
+ </customrules>

+ + + \ No newline at end of file