dotTEST ships with the rule map editor - a web interface for modifying ("mapping") already existing rules. The information about modifications will be stored locally on your machine - in the rulemap.xml
file in the specified rule mapping directory (see Specifying the Custom Rule and Mapping Directory).
You can change the basic properties of existing static analysis rules, such as name, severity, category, and ID, to help you achieve your organization's development policies and goals. For example, you can create new rule categories specifically for your company, such as "Company Standards" or "Company Safety Rules," and remap the built-in and custom rules to these new categories. You can also change the rule severities to target specific constructs. When rule properties are modified, the rule is considered to be "mapped".
In this section:
Opening the Rule Map Editor
Click Parasoft in the menu bar and choose Options.
- Select Configurations.
- Ensure the rule mapping directory is configured (see Specifying the Custom Rule and Mapping Directory). All the information about rule customizations is stored in the specified directory.
- Click Edit Rule Map to open the rule map editor.
Editing Rule Properties
- Click the Rule Customization tab and locate the rule you want to customize. You can filter rules by typing in the search field or by enabling the Clones, Modified, or Custom filters.
Click on the rule in the table to view the rule properties and documentation.
You can perform the following actions in the Rule Properties panel:- Click in the Rule ID field to edit rule ID.
- Click in the Rule field to edit the rule name.
- Choose a severity from the Severity drop-down menu to change the severity of the rule.
- Click the [Edit Categories] link to open the Rule Categories editor (see Editing Rule Categories).
- Click Clone to create a duplicate of the rule. Cloned rules use the same internal logic as the original rule. Use this option to customize rule properties while preserving the properties of the original rule. Cloned rules automatically appear in all test configurations and can be activated for execution.
When you change rule properties, the original values are also displayed. You can click Default to reset the rule properties to their original values.
- Click Save to save any changes you made to the rule.
Editing Rule Categories
You can change the category a rule belongs to in the Rule Categories editor. Click the [Edit Categories] link in the Rule Properties panel to open the editor.
You can perform the following actions:
- Choose a category and click the Assign button to assign the rule being edited to the selected category. Click Save in the Rule Properties panel to preserve the change.
- Click on a category name to activate the field and edit the category name.
The category name is saved after leaving the text field.
Changing the category name affects all the rules in this category.
You can click the revert button to reset the category name.
- Click New to define a new category.
- Click the delete button to delete the selected rule category. Only custom categories created in the overlay can be deleted.
After you have modified the rule properties in the rule map, the rule changes are applied to all test configurations built-in and user test configurations that are locally available.
Uploading Rule Map Files (rulemap.xml)
You can upload an already existing rule mapping file, for example, a file exported from the DTP Rule Map Editor (see the DTP documentation for details).
- Click the Upload/Download tab.
- Select File in the Rule mapping section.
- Browse to the file you want to upload and click Upload.
Uploading Custom Rules
Refer to the Rule Wizard documentation for instructions on creating custom rules (contact your Parasoft representative for information). Rule Wizard outputs custom rules in a .rule file that can be uploaded and modified with the Rule Map Editor.
- Click the Upload/Download tab.
- In the Custom Rule section, click Select Files and browse fro the .rule file(s) you want to upload.
- Click Upload to finish uploading the .rule(s).
- Click the Rule Customization tab and locate the custom rule to verify that it has been uploaded. You can filter rules by typing in the search field or by enabling the Clones, Modified, or Custom filters.
If you added rule documentation when creating the rule, it will also appear.
Some rules created in Rule Wizard are complex, so the .rule file may be accompanied by an ext subfolder that contains an extension for the rule. You can compress the .rule file and extension folder into a .zip file and, and then upload the .zip file. The file will be decompressed and stored in the configured location (see Specifying the Custom Rule and Mapping Directory).