Fixing a problem reported in a result

You can modify a source code file to fix a problem that is detected by code review.

Before you begin

You must run a code review and open the results in the Software Analyzer Results view.

About this task

The Code Review component opens analyzed source files in the COBOL Editor, PL/I Editor, or System z® LPEX Editor . You can use these editors to fix problems that are reported by the Code Review component. You can also remove, hide, or show code review results in the editor.

Fixing a problem in the source code

Procedure

  1. In the right pane of the Software Analyzer Results view, expand the rule that contains the results that you are interested in.
  2. Below the rule right-click a result and click View Result. The source code file is opened in a supported language editor and is positioned to show the lines of code that are flagged by the result. The editor that opens depends on the editor configuration and on the editor that was last used to open a file of the same type. The lines are temporarily selected so that they are highlighted. Icons are displayed in the left and right margins next to the first line of the affected area. Hovering the mouse over either icon displays the text of the rule.
    In the example in Figure 1 the rule is Avoid IF without ELSE and the severity is Warning. The following highlighting is shown:
    • The entire IF statement is underlined with a squiggly line.
    • Icons are displayed in the vertical ruler (left margin) and the overview ruler (right margin) on the first line of the problem source code.
    • The icon in the vertical ruler is a severity icon that matches the severity of the rule.
    • Hovering the mouse over either icon displays the rule text, Avoid IF without ELSE.
    Figure 1. View of a rule violation displayed in the COBOL language editorExample of a rule result in the editor
  3. Modify the source code to fix the problem that caused the result to be generated. You are not limited to fixing one problem. You can make as many updates to the source code file as you want, as you would normally do in the editor.
  4. Save the file and close the editor.
  5. To verify that your change to the source code fixed the problem, run the code analysis again.

Removing, hiding, and showing code review highlights

About this task

The highlighting of source code text that is affected by a code review result is present in any of the supported editors. For information about supported editors, see Supported editors.

The highlighting remains with the source code file until one of the following events occurs:
  • The problem is fixed and another code analysis is run on the source code file.
  • The development workbench is closed.
  • You remove the icon as you would remove a regular bookmark.
    Note: The severity icon is a type of bookmark. Therefore, you can remove a severity icon from the left margin of the editor at any time as you would remove any bookmark.

Procedure


Feedback