The COBOL Rule Template wizard adds
rule and category extensions to the plugin.xml file
that is generated for the custom rule plug-in project.
The
plugin.xml file contains extensions
to register the new custom rule and its category with Eclipse.
Figure 1 shows the extension for a custom
rule:
Figure 1. Extension for a custom rule<extension
point="com.ibm.rsaz.analysis.core.analysisRule">
<analysisRule
category="category_id"
class="rule_class"
id="rule_class"
label="rule_label"
severity="1">
</analysisRule>
</extension>
If the category does not exist, the wizard also adds
the extension for the category to the
plugin.xml file.
Figure 2 shows the extension for a category:
Figure 2. Extension for the category of a
custom rule<extension
point="com.ibm.rsaz.analysis.core.analysisCategory">
<analysisCategory
class="com.ibm.rsaz.analysis.core.category.DefaultAnalysisCategory"
id="category_ID"
label="category_name"
provider="codereview.cobol.analysisProvider">
</analysisCategory>
</extension>
Table 1 shows how the attributes of the
<analysisRule> and
the
<analysisCategory> elements are derived
from the values that were entered in the
Plug-in Project wizard:
- In the <analysisRule> element, the category, ruleclass, ruleid,
and rulelabel attributes are set to the values that
you entered on the COBOL Rule Template page of
the wizard. The value that is specified for the rule class is also
used to set the rule ID.
- In the <analysisCategory> element the id and label attributes
are set to the values that you entered on the COBOL Rule
Template page.
- The package name, which is shown in the Example column as com.example,
is set to the string that was specified in the ID field
of the package definition, on the Content page
of the New Plug-in Project wizard.
Table 1. Attributes of analysisRule
and analysisCategory| Attribute: |
Field on the COBOL Rule Template wizard
page: |
Example: |
| analysisRule.category |
Category ID |
com.example.custom |
| analysisRule.ruleclass |
Rule class |
com.example.CobolRule |
| analysisRule.ruleid |
Rule class |
com.example.CobolRule |
| analysisRule.rulelabel |
Rule label |
My custom COBOL rule |
| analysisCategory.id |
Category ID |
com.example.custom |
| analysisCategory.label |
Category name |
Custom |