In addition to the set of code review rules that are shipped with
the product, you can create your own rules based on a set of templates. Each
template corresponds to a generic rule with a set of empty parameters for
which you supply values. Supplying a set of values creates a new rule from
the template that can be shared between team members.
To create a rule from a template:
- Click , expand Java,
select Code Review, and click OK.
The Code Review view opens.
- Click Window > Preferences. The Preferences
window opens, showing the Code Review page.
- In the left pane, expand Java , then select Code
Review.
- In the Preferences window click New rule.
The New Code Review Rule wizard opens and provides templates
for the following categories of rules:
- General
- J2EE Best Practices
- On the Select rule template page, click the template you want to
use for your rule. When you select a template, the text below the list provides
information about the rule you create from it.
- Click Next.
- On the Configure page under Basic properties,
specify the following information:
- Category: Accept the default category that the rule is assigned
to or click Browse to select a different category.
From the list, select the category you want the rule assigned to and click OK.
- Severity Level: Click Problem, Warning,
or Recommendation to indicate how strictly you want
to enforce the rule.
- Under Specific properties, specify the properties
that are dependent upon the template you chose. These properties are unique
to your rule, such as a file or class in your own application.
- Click Finish to return to the Preferences window
where you see that your rule has been added to the appropriate code review.