The Structural Analysis code review applies rules that mine code
structure for antipatterns. Antipatterns are structural problems where
a component has a large number of elements that either depend on it, or that
it depends on, which create code that is unnecessarily complex and hard to
maintain.
The following list shows the rule categories included in this code review
and describes the specific areas that they target:
- Breakable: Contains structural analysis rules for flagging objects with
excessive immediate dependencies.
- Cyclic Dependencies: Contains structural analysis rules for flagging cyclic
dependencies between objects.
- Hub: Contains structural analysis rules for flagging objects with excessive
immediate dependencies and immediate dependents.
You can modify the supplied rules and create additional ones. For example,
if you want to ensure that the integrity of your application architecture
is maintained throughout the development process, you can define rules for
architectural control. These rules are then included in the Structural Analysis
code review.
The Design Principles rule category contains rules that ensure that the
code adheres to the design principles of object-oriented programming. Rules
in this category include the following examples:
- Avoid conditional expressions with more than 4 operators
- Avoid nesting more than 1 class
- Avoid nesting more than 1 if statement
When you run the Structural Analysis code review or the Design Principles
rules on your code, you can see if any new dependencies or changes to the
structure are introduced, and fix these problems early in the development
process.
Detailed information on a rule
You can get information about each rule, category, and code review in the
Preferences window. See "Java™ preferences - Code Review page" for
details.
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.