You
can use a provided rule template to create custom rule categories and rules
for software analyses.
About this task
To create custom rule categories and rules:
Procedure
- Click Window > Preferences > Software Analyzer > Custom
Rules and Categories.
- To add a custom rule category, on the Custom Rules and
Categories page, click Add Category.
- In the Add Custom Category window, click a
parent category for your custom rule category and click Next.
- Type a name for the new category.
- Click Finish and verify that the new rule
category is listed in the Current Custom Categories tree.
- On the Custom Rules and Categories page, click Add
Rule.
- In the Add Custom Rule window, click the category
to which to add the custom rule and click Next.
- Click the rule template to use as a model for the new rule and
click Next.
To create the rule, provide
the required values. Depending on the template that you select, the following
values might be required:
- The fully qualified class name for the new rule; for example, java.lang.String
- The name of the method that detects method invocations in the source
code
- The number of arguments that the method uses
- The severity level for the new rule (recommended, warning, severe)
- Click Finish and verify that the new rule
is listed in the Current Custom Rules tree.