Objective
Understand how to explore and correct violations identified during coding standard analysis that may result in construction defects.
- Select Parasoft > Show View> Quality Tasks (if not displayed already).
- Open the Quality Tasks menu and select Configure Contents
- Select Details from the Configuration list and click OK.
- Expand the the Fix Static Analysis Violations folder to review coding conventions violations reported for the ATM project.
The constructor error (CODSTA-CPP-04-1) is a very common defect associated with user-defined conversion functions. - You can right-click the violation and select View Rule Documentation from the shortcut menu for guidance on how to fix the code.
- Double-click the reported violation to view the code in the source editor will open and the cursor will be placed at the line with the reported violation.
- Fix the defect by adding the
explicit
keyword to theAccount
function: - Select File > Save from the main menu or click the save button in the main toolbar to update the code.
- Rerun coding standards analysis (see steps 2 and 3 in Exercise 1). The CODSTA-CPP-04-1 violation is no longer reported.