Creating rules files
You can create rules files that contain sets of rules to apply
during a static analysis code review that you can run outside a standard analysis
configuration at the command line, or in an Ant script.
A rules file contains one or more analysis rules. When you create
a rules file, you work in the Analysis
window to determine
the type of analysis to perform and the particular rules to export to the
rules file. For example, you can add to a rules file, a complete rule category,
such as J2SE best practices, or a subset of category, such as individual rules
that generate results if the code does not initialize static fields, or if
it calls the sleep() method inside a while loop.
To create a rules file:
- Click .
- In the Analysis window, in the Configurations pane,
click Analysis and click New.
- To specify the rule categories or rules to add to a rules file,
click the Rules tab.
- In the Analysis domains and rules field,
expand the tree and select the Code Review for Java™ domain, its rule categories, and rules.
To select all the rules defined by a rule category, select a top-level rule
- Optional: To show any configuration or additional information
that might exist for a rule, and to change the severity rating and other rule
parameters, click the rule; then click Details.
- Click Export and, in the File
name field, type a name for the rules file.
- Browse to the location to store the rules file; then click Save.