Rational Developer for System z

Fixing a problem reported in a result

This topic describes how to modify a source code file to fix a problem detected by code review.
This topic contains the following subtopics:

Fixing a problem in the source code

Follow these steps:

  1. In the right pane of the Software Analyzer Results view:
    1. Expand the rule containing the results that you are interested in.
    2. Below the rule right-click a result and click View Result.
  2. The source code file in which the result was found is opened in one of the supported editors.
    Note: Which editor opens depends on the editor configuration and on which editor was last used to open a file of the same type.
    In the editor:
    • The source code file is positioned to display the lines of code that are affected by the result.
    • The affected lines of code are highlighted or are underlined with a squiggly line.
    • The severity icon for the rule is displayed in the left margin at the first line of the problem. Floating the mouse over the 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) of the editor to mark 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. In the editor:
    1. Modify the source code to fix the problem that caused the result to be generated.
      Note: You are not limited to fixing one problem. You can make as many updates to the source code file as you wish, as you would normally do in the editor.
    2. Save the file and close the editor.

At this point, you can rerun the code analysis to verify that your change to the source code fixed the problem.

Working with the code review highlighting

The highlighting of source code text affected by a code review result is present in any of the supported editors. See Editors that support COBOL and PL/I Code Review.

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.
  • Developer for System z 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.
You can hide or show the code review icons in the margins of the editor from within the editor itself:
  1. Right-click over the vertical ruler (left margin) or the overview ruler (right margin) of the editor.
    Note: In the Basic LPEX editor or the System z LPEX editor, you must click over the left margin.
  2. Click Show software analysis annotations to hide or show the icons in the margins.
Note: When you open a source code file into a supported editor from a result in the Software Analyzer Results view, the editor changes the setting to show the code review icons in the margins.
You can also use the workbench Preferences window to hide or show the code review highlighting:
  1. Click Window > Preferences > General > Editors > Text Editors > Annotations.
  2. In the Annotation types list, click the entry for one of the icons. The identifiers are:
    • Code review recommendation
    • Code review severe problem
    • Code review warning
  3. To show or hide the highlighting:
    1. Select Vertical ruler or Overview ruler to show the icon in the ruler, or clear the option to hide the icon.
    2. Select Text to display the highlighting or hide the highlighting.


Feedback