You can view and modify existing definitions of potential code anomalies (other than range overlaps and range jumps) in the Coding Standards folder in the Interactive Analysis Search dialog box. In Interactive Analysis, click Advanced Search to open the Search dialog box and expand Criteria to view 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:
For some languages, such as C and C++, there are no pre-defined Code Search queries, so they have not been listed.
You can find the full list of models in the Enterprise Analyzer installation directory, under \Model\HyperCode. You can find the exact name of the model to use in the CodeDefects.xml in the model file itself. For example, you can find the model name for COBOL in the NAME attribute in the following line in the Cobol.xml file:
<HYPERCODEMODEL NAME="COBOL" DESCRIPTION="COBOL Programs" VERSION="1.1">
This opens the Options - Project properties dialog box.
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: