This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Compare Metrics Against Software Quality Objectives

After generating and viewing metrics from your analysis results, you can review the results in greater detail.

To focus your review, you can:

  1. Define quality objectives that you or developers in your organization must meet.

  2. Apply the quality objectives to your analysis results.

  3. Review only those results that fail to meet those objectives.

Apply Predefined Objectives to Metrics

By default, the software quality objectives are turned off. To apply quality objectives:

  1. In the Polyspace® Metrics interface, open the metrics page for a project.

  2. From the Quality Objectives list in the upper left, select ON.

    A new group of Software Quality Objectives columns appears.

    • The Overall Status column shows the last used quality objective level to generate a status of PASS or FAIL for your results.

    • The Level column shows the quality objective level.

      To change your quality objective level, in this column, select a cell. From the drop-down list, select a quality level. For more information, see Bug Finder Quality Objective Levels.

  3. For files with an Overall Status of FAIL, to see what causes the failure, view the entries in the other Software Quality Objectives columns. The failing levels are marked red.

    If the icon appears next to the status, it means that Polyspace does not have enough information to compute the status. For instance, if you specify BF-QO-1, certain coding rules must be review. But, if you do not check coding rules during the analysis, Polyspace cannot determine whether your project satisfies the coding rule objectives specified in BF-QO-1.

  4. To investigate the failing quality objectives, select the entries marked red for more details.

  5. On the Code Metrics, Coding Rules, or Bug-Finder tab,

    1. Select the red column entries to download the results.

    2. Review the violations and fix or justify the results.

      See Address Polyspace Results Through Bug Fixes or Comments.

    3. Upload your new justifications to the Polyspace Metrics web dashboard.

  6. After your review, in the Polyspace Metrics interface, click to view the updated metrics.

    If you change your code, to update the metrics, rerun your analysis and upload the results to the Polyspace Metrics repository. If you have justifications in your previous results, import them to the new results before uploading to the repository.

Bug Finder Quality Objective Levels

The Bug Finder Quality Objectives or BF-QOs are a set of thresholds against which you can compare your Bug Finder analysis results. These objectives are adapted from the Polyspace Code Prover™ Software Quality Objectives (Polyspace Code Prover). You can develop a review process based on the Quality Objectives.

You can use a predefined BF-QO level or define your own. Following are the predefined quality thresholds specified by each BF-QO.

 BF-QO Level 1

 BF-QO Level 2 and 3

 BF-QO Level 4

 BF-QO Level 5

 BF-QO Level 6

 BF-QO Exhaustive

Customize Software Quality Objectives

Instead of using a predefined objective, you can define your own quality objectives and apply them to your project.

  1. Save the following content in an XML file. Name the file Custom-SQO-Definitions.xml.

    <?xml version="1.0" encoding="UTF-8"?>
        <SQO ID="Custom-BF-QO-Level" ApplicableProduct="Bug Finder" ApplicableProject="My_Project">
        <CodingRulesSet ID="Custom_MISRA_Rules_Set">
            <Rule Name="MISRA_C_5_2">0</Rule>
            <Rule Name="MISRA_C_17_6">0</Rule>
        <BugFinderChecksSet ID="Custom_BF_Checks_Set">
            <Check Name="UNREACHABLE">0</Check>
            <Check Name="USELESS_IF">0</Check>

    You can use this file for both Bug Finder and Code Prover results. For information on the XML elements specific to Code Prover, see Compare Metrics Against Software Quality Objectives (Polyspace Code Prover).

  2. Save this XML file in the folder where remote analysis data is stored, for example, C:\Users\JohnDoe\AppData\Roaming\Polyspace_RLDatas.

    If you want to change the folder location, select Metrics > Metrics and Remote Server Settings.

  3. To make the quality level Custom-BF-QO-Level applicable to a certain project, replace the value of the ApplicableProject attribute with the project name.

    If you want the quality objectives to apply to all projects, use ApplicableProject="".

  4. Modify the file to specify your thresholds.

    For specifying coding rules, begin the rule name with the appropriate string followed by the rule number. Use _ instead of a decimal point in the rule number.

    RuleStringRule numbers
    MISRA C: 2004MISRA_C_MISRA C:2004 and MISRA AC AGC Coding Rules
    MISRA C: 2012MISRA_C3_MISRA C:2012 Directives and Rules
    MISRA C++MISRA_Cpp_MISRA C++:2008 Rules
    JSF® C++JSF_Cpp_JSF C++ Coding Rules
    Custom coding rulesCustom_Custom Coding Rules

    For specifying defects, use the defect acronym. See Short Names of Bug Finder Defect Checkers.

    For specifying code metrics, use the code metric acronym. See Short Names of Code Complexity Metrics.

  5. After you have made your modifications, in the Polyspace Metrics interface, open the metrics for your project. From the Quality Objectives list in the upper left, select ON.

  6. On the Summary tab, select an entry in the Level column. For the project name that you specified, your new quality objective Custom-BF-QO-Level appears in the drop-down list.

  7. Select your new quality objective.

    The software compares the thresholds you had specified against your results and updates the Overall Status column with PASS or FAIL.

  8. To define another set of custom quality objectives, add the following content to the Custom-BF-QO-Definitions.xml file:

    <SQO ID="Custom-BF-QO-Level_2" ParentID="Custom-BF-QO-Level" ApplicableProduct="Bug Finder" ApplicableProject="My_Project">

    • ID represents the name of the new set.

      You cannot have the same values of ID and ApplicableProject for two different sets of quality objectives. For example, if you use ID="Custom-BF-QO-Level" for two different custom sets, and ApplicableProject is either My_Project or "" for both sets, you see the following error:

      The SQO level 'Custom-BF-QO-Level' is multiply defined.

    • ParentID specifies another level from which the current level inherits its quality objectives. In the preceding example, the level Custom-BF-QO-Level_2 inherits its quality objectives from the level Custom-BF-QO-Level.

      If you do not want to inherit quality objectives from another level, omit this attribute.

    • ... represents the additional quality thresholds that you specify for the level Custom-BF-QO-Level_2.

      The quality thresholds that you specify override the thresholds that Custom-BF-QO-Level_2 inherits from Custom-BF-QO-Level. For instance, if you specify <goto>1</goto>, this objective overrides the threshold specification <goto>0</goto> of Custom-BF-QO-Level.

Elements in Custom Quality Objective Files

The following tables list the XML elements that can be added to the custom BF-QO file. The content of each element specifies a threshold against which the software compares analysis results. For each element, the table lists the metric to which the threshold applies. Here, HIS refers to the Hersteller Initiative Software.

HIS Metrics

comfComment Density
pathNumber of Paths
gotoNumber of Goto Statements
vgCyclomatic Complexity
callingNumber of Calling Functions
callsNumber of Called Functions
paramNumber of Function Parameters
stmtNumber of Instructions
levelNumber of Call Levels
returnNumber of Return Statements
vocfLanguage Scope
ap_cg_cycleNumber of Recursions
ap_cg_direct_cycleNumber of Direct Recursions
Num_Unjustified_ViolationsNumber of unjustified violations of coding rules specified by entries under the element CodingRulesSet
Num_Unjustified_BF_ChecksNumber of unjustified defects of types specified by entries under the element BugFinderChecksSet

Non-HIS Metrics