Creating custom rule categories and rules for software analyses

You can use a provided rule template to create custom rule categories and rules for software analyses.

Before you begin

About this task

To create custom rule categories and rules:

Procedure

  1. Click Window > Preferences > Software Analyzer > Custom Rules and Categories.
  2. To add a custom rule category, on the Custom Rules and Categories page, click Add Category.
  3. In the Add Custom Category window, click a parent category for your custom rule category and click Next.
  4. Type a name for the new category.
  5. Click Finish and verify that the new rule category is listed in the Current Custom Categories tree.
  6. On the Custom Rules and Categories page, click Add Rule.
  7. In the Add Custom Rule window, click the category to which to add the custom rule and click Next.
  8. 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)
  9. Click Finish and verify that the new rule is listed in the Current Custom Rules tree.

What to do next


Feedback