Audits and Metrics Facilities
Go Up to Source Code Audits and Metrics
Contents
The source code Audits and Metrics help you enforce company standards and conventions, capture real metrics, and improve your work.
You can apply:
- Audits to Delphi and C++ projects.
- Note: C++Builder does not support Audits on 64-bit iOS.
- Metrics to Delphi projects.
As with any QA (Quality Assurance) features, working with the source code Audits and Metrics, you should understand what is measured and why. Although Audits and Metrics are similar in that they both analyze your source code, they serve different purposes. Audits and Metrics are run as separate processes. Because the results of these two processes are different in nature, the source code Audits and Metrics provide different features for interpreting and organizing the results.
Warning: Audits and Metrics are not available for design projects.
The video Audits DCC in Delphi 2010, by Mike Rozlog shows how to use audits to find duplicate code.
Audits
You can run the source code Audits in both Delphi and C++ projects.
When you run Audits, you can select specific Audits (rules) to which your source code should conform. You can select the set of audits to run in the QA Audits dialog box for Delphi projects and in the C++ Audits Configuration dialog box for C++ projects. The results of Audits processing display only the violations of those rules so that you can examine each problem and decide whether to correct the source code. Audits provides a wide variety of audits to choose from. The available audits are ranging from design issues to naming conventions, along with descriptions of what each audit looks for and how to fix violations. See the lists of available audits for Delphi projects in the QA Audits dialog box and for C++ projects in the C++ Audits dialog box.
Metrics
You can run the source code Metrics only in Delphi projects.
Metrics evaluates object model complexity and quantifies your code. It is up to you to examine results of Metrics and decide whether they are acceptable. The results of Metrics can highlight parts of code that need to be redesigned or they can be used for creating reports and for comparing the overall impact of changes in a project. Along with the set of metrics, Metrics provides tips for using metrics and interpreting results. Metrics supports a wide range of metrics. See the descriptions of available metrics in the QA Metrics dialog box.
Metrics results can also be viewed graphically. Two graphic views allow you to summarize Metrics results: bar charts and Kiviat charts. Both charts are invoked from the context menu of the Metrics Results table.
Bar Charts
Use bar charts for columns in the Metrics pane.
The bar chart displays the values of a selected metric for all packages, classes, and/or operations.
The bar color reflects conformity with the limiting values of the metric in reference:
- Green represents values that fall within the permissible range.
- Red represents values that exceed the upper limit.
- Blue represents values that are lower than the minimal permissible value.
- A thin vertical red line represents the upper permissible limit and a thin vertical blue line represents the lower permissible limit.
Kiviat Charts
Use Kiviat charts for rows in the Metrics pane.
The Kiviat chart demonstrates the analysis results of the currently selected class or package for all the metrics that have predefined permissible limits for values. Metrics results are arranged along the axes that originate from the center of the graph.
Each axis has a logarithmic scale with the logarithmic base being the axis metric upper limit. Therefore, all upper-limit values are equidistant from the center. In this way, limits and values are displayed using the following notation:
- Upper limits are represented by a red circle. Any points outside the red circle violate the upper limit.
- Lower limits are represented by blue shading, showing that any points inside the blue area violate the lower limit. Note that blue shading does not show up in areas of the graph with lower limits of
1
or0
.
As the mouse cursor hovers over the chart, the tooltip opens. It displays information about the metric or metric value under the cursor.
Kiviat charts use the following graphical elements:
- An actual metric shows up in the form of a star with the metric value drawn as the point.
- Green points represent acceptable values.
- Blue points represent values below lower limits.
- Red points represent values exceeding upper limits.
- Charts display scale marks as clockwise directional ticks perpendicular to the Kiviat ray.
- Charts display lower-limit labels as counterclockwise directional blue ticks perpendicular to the Kiviat ray.
Sets of Active Audits and Metrics
The QA Auditsor C++ Audits Configuration and QA Metrics dialog boxes display the sets of all available audits or metrics.
When you open a project, the default sets of audits and metrics are active. Active audits and metrics are indicated by check marks in the QA Audits, C++ Audits Configuration, or QA Metrics dialog box. If you open the QA Audits, C++ Audits Configuration, or QA Metrics dialog box and click Start, all active audits or metrics are processed.
If you do not want to process every audit or metric in the default set each time, you can create and save (in files) customized sets of active audits and metrics. Saved sets can be loaded (from files) and processed as you choose. Use the Save audit set and Load audit set toolbar buttons in the QA Audits, C++ Audits Configuration, and QA Metrics dialog boxes.
In Delphi projects, you can restore the default active sets of audits or metrics using the Set default toolbar buttons.