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 cac_useresults_sarview_modifycode.html#fixingaprobleminthesourcecode__fig_sourcecode 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 editor
    Example 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.