You can create a rule to alert you if extraneous dependencies are
introduced into your application's code. The New Code Review Rule wizard
provides templates for architectural control rules that you can customize
for your application. You make rules unique by specifying properties for them.
To create an architectural control rule:
- 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.
- In the Select rule template list, under Architectural
Control, 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.
- In the Configure window, under Basic properties,
specify the following information:
- Category: Accept the default category, Structural
Analysis, to which the rule is assigned.
- 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 Structural Analysis
code review.
Note: You can run the Structural Analysis code review on the workspace,
a working set, or a project. However, if you run it on a single file, no results
are displayed.