Running a code review in the IDE

A code review analyzes source files against a set of rules to detect problems in coding practices. The scope of the analysis is determined by the method you use to start the analysis.

About this task

You can start a code review by selecting a software analysis configuration from the following locations:
  • A menu of existing configurations in the Eclipse toolbar
  • The software analysis configuration editor
  • The project explorer
  • The COBOL or Remote Systems LPEX editor
When you run a code review, the Code Review component determines the scope of the software analysis. The scope is the source code files to which the rules are to be applied. The scope is set in the software analysis configuration to be either the entire workspace, a resource working set, or selected projects. However, you can override the configured scope when you start the software analysis. The actual runtime scope is determined by the method that you use to start the code review:
Start method: Runtime scope:
The Eclipse toolbar The scope that is set in the software analysis configuration.
The software analysis configuration editor
The project explorer The projects or source files that are selected in the project explorer view.
The editor The source file that is open in the editor.

Starting from the main toolbar

About this task

This method runs the code review by using the scope that is specified in the selected software analysis configuration.

Procedure

  1. Click the down arrow beside the Software Analysis Software Analysis button on the main toolbar.
  2. Click the name of the software analysis configuration that you want to run.

Starting from the software analysis configuration editor

About this task

This method runs the code review by using the scope that is specified in the software analysis configuration.

Procedure

  1. Open the software analysis configuration editor.
  2. In the left pane, select the analysis configuration that you want to run.
  3. Click Analyze. The editor closes and the code review is run by using the scope that is specified in the selected configuration.

Starting from a Project Explorer view

About this task

This method runs the software analysis on the projects or source files that are selected in the current project explorer view.

Procedure

  1. In the project explorer view, select the projects or files to which you want the software analysis to be applied.
  2. Right-click one of the selected projects or source files and then click Software Analyzer.
  3. Click the name of the software analysis configuration that you want to use. The code review is run on the selected projects or files, by using the rules that are specified in the selected analysis configuration.

Starting from the editor

About this task

This method runs the software analysis on the source code file that is open in the COBOL or the Remote Systems LPEX editor. This method can be used to run either a local or a remote source code file. However, this method is the only way to run a code review on a remote source code file.

Procedure

  1. Open a source code file in the editor.
  2. Right-click the text area and then click Software Analyzer.
  3. Click the name of the software analysis configuration that you want to use. The code review is run on the file opened in the editor, by using the rules that are specified in the selected analysis configuration.

Results

The Code Review component applies the rules in the software analysis configuration to each source code file in the scope and records two types of results:
  • An expandable tree in the Software Analyzer Results view in which the results are organized by rule category, rule, source file, and source code line number. Clicking a result in the tree opens the source code file in the editor at the location where the problem was found.
  • Highlighted lines of code where each problem is found. The editors that support this highlighting are the COBOL or the Remote Systems LPEX editor.

What to do next

For information about viewing code review results and fixing problems, see the following topics:

Feedback