Creating user-written rules

User-written rules are implemented by Java™ classes that call EGL code analysis APIs.

About this task

To create a user-written rule, follow these steps:
  1. Use a wizard to generate a plug-in project for EGL code analysis. Specify the types of code statements that you want to analyze. These are broken into 2 sets: AST model and IR model. The difference is that the AST model provides unbound information about the specific node to be processed. If your rule requires that information associated (bound) with the selected type of code statement is required, then use the IR model instead. AST model nodes process more quickly than IR model elements.
  2. Develop Java code that calls the code-analysis APIs. You can inspect the types of code statements that you are interested in and either accept or reject each instance.
  3. Install your user-written rule plug-in into the development workbench.

Each of these steps is described in more detail in the following topics.

After you create and install a user-written rule project, you can later add more rules to it. See the links at the end of the topic.

Note: User-written rules are different from custom categories and custom rules. You create custom categories and rules with wizards in which you can select processing options for certain types of rules. See the link at the end of the topic.

Feedback