Rules and rule categories for static analysis

Rules are the smallest building blocks of a static analysis configuration. Each analysis configuration applies different rules, or sets of rules, that define the conditions that generate results and that assess the quality, or determine the structure, of resources. A rule category is a collection of analysis rules, or other categories, that focuses on a particular aspect of standards compliance, or on an accepted practice.

Rules

A rule is a specific statement that describes an action to follow when you write code, or a description of a particular solution to a commonly encountered problem in software design.

The following list shows examples of code review rules and architectural discovery patterns:

Rules form the basis of an analysis configuration. When you run an analysis, you check whether the resources comply with a specific rule, or set of rules. You can modify rules and create user-defined rules if you need them to apply to specific application design standards. The code review rules listed earlier, for example, belong to the design principles category. Rules that apply to similar capabilities, or code structures, belong to the same category. You can apply rules from several categories depending on the purpose of the review.

Rule categories

Analysis domains are components of the analysis framework that implement groups of tools that contain categories. You can select different domains for different types of analysis and, depending on the requirements of your analysis, you can enable or disable a rule category and individual rules in the category.

An example of a rule category is the performance category in the Code Review for Java™ domain. Performance, as an important aspect of the overall quality of an application, should be one of the characteristics you test in a code review. The performance rule category has three subcategories, memory, profiling, and speed, each of which contains a set of rules that you apply to source code when you run an analysis with this category selected.

An example of a rule category in the Architectural Discovery for Java domain is the object-oriented patterns category. This category contains rules that identify abstraction and inheritance tree patterns, which identify an abstract class or interface and the implementation or extension of a class.

Related tasks
Creating and editing static analysis configurations
Creating custom rule categories and rules for static analysis
Creating rules files