Code review rules

Rules are the smallest building blocks of a code review. Each code review applies different rules to assess the quality of a code base.

A code review rule is a specific statement that describes one action to follow when you write code, as shown in the following example:

Rules form the basis of a code review. When you run a code review, rules are applied to a code base to see if the code adheres to them. You can modify supplied rules and create user-defined rules that are specific to your application design standards.

Rules that focus on similar functionality are in the same category. The previous sample rules are in the design principles category. Depending on the purpose of a code review, rules from various categories are applied.

Detailed information on a rule

You can get information about each rule, category, and code review in the Preferences window. For details, see the topic “Java preferences - Code Review page” for details.

Severity levels for rules

Each rule has one of the following severity levels:

Although "recommendation" is the lowest severity level, do not discount how important it is to address these findings. They reflect a set of best practices and industry standards that engineering teams should adhere to. Even if these findings are not immediate problems, they could lead to problems in the future.

Rules that focus on similar functionality are in the same category. The previous sample rules are in the Design Principles category. Depending on the purpose of a code review, rules from various categories are applied.

Automated fixes for some rule findings

When a rule is not adhered to, the code review produces a finding. Some common findings come with a quick fix, which is a supplied automated solution. If a finding in the code review has a quick fix, it is indicated by one of the following icons:

Supplied rules

The following information is provided for a supplied rule:

User-defined rules

You can create rules from supplied templates using a wizard. The wizard lets you choose templates for the following types of rules: You can use these templates to extend the capabilities of code review.
Related concepts
Code reviews
Rule categories
Related tasks
Reviewing code automatically
Running code reviews
Configuring code reviews
Creating user-defined rules
Related reference
Prerequisites for running code reviews
Rule Category Descriptions
Types of code review
Code Review view
Complete code review
New Code Review Rule wizard
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.