Page tree
Skip to end of metadata
Go to start of metadata

Creating new rules for Diagnostic Report

Please note that this feature is a legacy feature and is maintained only for compatibility with previous CAST versions. CAST now provides the CAST Health and Engineering Dashboards to help enforce rules and standards in an organization. Please contact CAST for more information about this.

This page discusses a folder called "TPL HTML" and a file called "diagnostic.xml", which are central to the creation of user defined diagnostics for use in the "Report with Diagnostic" wizard. However, these elements are no longer available when installing current versions of CAST. If you want to continue using the "Report with Diagnostic" feature, you will need to create the "TPL HTML" folder and re-use the "diagnostic.xml" file you were using with previous releases of CAST.

The Report with Diagnostic feature consists of a set of diagnostics adapted specifically to Java, VB, .NET and Oracle Forms that can be run to automatically check the respect of coding standards and enforcements for code performance and maintainability. Each diagnostic is highly customizable to fit specific technical environments.

When running a diagnostic you can select various combinations of rules that will serve to check the respect of coding standards within your environment. CAST ships a set of example rules to get you started, but as your needs develop, you may want to create your own rules. To do so, you first need to write the rules.

Writing a rule

Below is an example of a rule saved in HSQ format:

/*FileTitle:=JAVA - Coding standards*//*Description:=List of non conform packages.*//*Lang:=Java*//*InputGrid:=Please select Analysis name,APPNAME;Query:=Select '''' + co1.OBJECT_NAME + '''' From CASTKB..CSV_OBJECTS co1 Where co1.OBJECT_TYPE = 'Java Project'*//*#CwDocTag#;Lev:=0;Title:=;Type:=Text;Hide:=1,2*/Select co1.OBJECT_ID, co1.OBJECT_NAME From CASTKB..CSV_OBJECTS co1 Where co1.OBJECT_NAME in (APPNAME)

Rules can be written with the Report On SQL Query dialog box or you can write them manually.

Once created, you need to store your new rule alongside the other rules used in the Diagnostic Wizard. Typically when you install a CAST product, all files will be stored in a similar place to:

C:\Program Files\CAST\SQL Server\CAST\

Within this folder, you will find another sub-folder called "Tpl HTML". Store your new rule here. You can either store it in an existing sub-folder or in a newly created sub-folder.


Before you can view your new rule in the Diagnostic Wizard, you need to alter another file that tells the application how to display the rule (i.e. where to place it in the list).

This file is called Diagnostic.XML and can be found in every sub-folder in the "Tpl HTML" folder. Each instance of this file tells the application how to display the current folder and its rules.

Placing the rule in an existing folder

Locate the folder in which you want to place the new rule using Windows Explorer and then open the corresponding Diagnostic.XML file. Opening this file in in a text editor will display something similar to:

<?xml version="1.0" encoding="iso-8859-1" ?><File_Template>   <info>      <name>Profile for Diagnostic</name>      <description>Profile for Diagnostic</description>   </info>   <Doc_HTML_File_ORA_CAMS>      <folder name="Diagnostics for Java">         <folder name="JAVA - Normalization">            <file name="DGJavaAnalysisList.hsq">               <file name="23.hsq" need="1"/>               <file name="24.hsq" need="1"/>               <file name="25.hsq" need="1"/>               <file name="26.hsq" need="1"/>               <file name="27.hsq" need="1"/>               <file name="28.hsq" need="1"/>               <file name="29.hsq" need="1"/>               <file name="30.hsq" need="1"/>               <file name="31.hsq" need="1"/>               <file name="32.hsq" need="1"/>               <file name="33.hsq" need="1"/>               <file name="34.hsq" need="1"/>               <file name="Normalization Summary Statistics.hsq" need="1"/>            </file>         </folder>      </folder>   </Doc_HTML_File_ORA_CAMS></File_Template>

You need to add details of your new rule to this file. To do so, create a new line in between the intial <file name="xxx.hsq"> tag, using your own file name parameters - i.e. the physical location on the hard drive in the "Tpl HTML" folder:

<file name="TEST.hsq" need="0"/>

The Need parameter indicates whether your rule requires an SQL query already defined in a rule stored at a higher level in the same tree hierarchy. Enter 1 to tell the application that this statement is true. Adding a 0 will indicate to the application that the rule does not need a parent rule to be selected first.

Once the new rule has been added, save the Diagnostic.XML file and launch the application to view your new rule.

Placing a rule in a new folder

To place your new rule in a new folder you also need to create a new Diagnostic.XML file:

  • First though, you need to create the folder in the "TPL HTML" folder, using Windows Explorer.
  • Now add the new rule to this folder.
  • Now create an XML file using Windows Explorer (you can create a TXT file and then rename it), place it in the new folder and then edit the parameters indicated in red:
<?xml version="1.0" encoding="iso-8859-1" ?><File_Template>   <info>      <name>Profile for Diagnostic</name>      <description>Profile for Diagnostic</description>   </info>   <Doc_HTML_File_ORA_CAMS>      
<folder name="TEST"> <file name="TEST.hsq" need="0"/> </folder> </Doc_HTML_File_ORA_CAMS> </File_Template>

Once the new rule has been added and the Diagnostic.XML file has been edited, save the Diagnostic.XML file and launch the application to view your new rule.


  • The tag <Doc_HTML_File_ORA_CAMS> may differ in the version of CAST you are using. If you are create a new Diagnostic.XML file, please make sure you use an existing Diagnostic.XML file supplied by CAST as a template.
What next?

For more information about the Report with Diagnostic, please click here and for more information about how to exploit the newly created rules, consult the Populate the Diagnostic wizard.

See Also

Report with Diagnostic

CAST Website

  • No labels