Defining Potential Code Anomalies

You can view and modify existing definitions of potential code anomalies (other than range overlaps and range jumps) in the Interactive Analysis advanced search criteria in the Coding Standards folder.

To define a new code anomaly, you must define an advanced search criterion for the anomaly and a matching entry in the file <EA Home>\Data\CodeDefects.xml. The entry has the form:

<DEFECT Id="name"
Internal="True|False"
Enabled="True|False"
Caption="display name"
ListName="list name"
Criterion="path of criterion"
Model="Model Type"/>

where:

Note: To get the code anomalies to appear on the report, you need to not only enable the Code defect entry, but to also select the Code Defects option from Project Options > Reports > Executive Report.

The following are examples of different defect entries:

<DEFECT Criterion="General:Coding Standards\MOVE Statements\Possible Sign Loss" 
ListName="Possible Sign Loss" 
Caption="Possible Sign Loss" 
Group="Cobol Coding Standards" 
Enabled="True" 
Internal="False" 
Id="Sign" 
Model="COBOL"/>
<DEFECT Criterion="General:Coding Standards\Unaligned Assignments" 
ListName="Unaligned Assignment" 
Caption="Unaligned Assignment" 
Group="Pli Coding Standards" 
Enabled="True" 
Internal="False" 
Id="Unaligned" 
Model="PLI"/>
<DEFECT Criterion="General:Java Best Practices\Basic\Empty If Statements" 
ListName="Empty If Stats" 
Caption="Empty If Statements" 
Group="Java Results" Enabled="True" 
Internal="False" 
Id="EmpIfStnts" 
Model="JAVAFILE"/>

You can display the anomaly caption in Japanese or Korean in the Executive Report by creating an entry for the anomaly in the file <EA Home>\Language\[Jpn|Kor]\CodeDefects.xrc. The entry has the form:

<String name="name"
listname="list name"
caption="translated display name"
description="description"/>

where: