Rules and rule categories

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 of your resources. A rule category is a collection of analysis rules, or other categories, that focus on a particular aspect of standards compliance.

A rule is a specific statement that describes one action to follow when you write code. For example, the following statements are code review rules:

Rules form the basis of an analysis configuration. When you perform an analysis, you check whether your resources comply with a specific rule, or set of rules. You can modify rules and create user-defined rules if you need them to be more specific to your application design standards. The 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 your review.

Severity levels

Rule authors assign a severity level to each rule to specify how seriously a resource that conflicts with the rule deviates from the standards. Each rule has one of the severity levels in the following table:

Icon Severity level Description
Green check mark icon. Recommendation This is the lowest severity level. The result indicates a problem that is not serious, but that you should consider fixing soon.
Brown exclamation point icon. Warning This severity level indicates that a resource very likely has a problem that you need to resolve.
Purple cross icon. Severe This is the highest severity level. It indicates that you should resolve the problem that the result points to.

Although recommendation is the lowest level, it is still important to address results with this severity level. Even if these results are not immediate problems, they could lead to problems in the future. The rules are based on a set of best practices and industry standards to which development teams should adhere.

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 for code reviews. 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 your source code when you run an analysis with this category selected.

Related tasks
Running a code review
Viewing code review results
Applying quick fixes to code review results
Running a code review from the command line
Running a code review as an Ant task
Related reference
Code review reference
Rule categories and subcategories
Command line code review reference