Main Content

polyspace-access -export

Export results from Polyspace Access database

    Description

    The system command polyspace-access -export exports results from a Polyspace® Access™ project to a text file.

    polyspace-access -export <resultsToExport> -output <filePath> [export options] -host <hostname> [login options] [output options] exports project results from the Polyspace Access database to a text file whose location you specify with <filePath>. You can specify filters when you export the results or export a comparison between two projects. You specify the project using either the full path in Polyspace Access or the run ID. Use this command to export results to other tools that you use for custom reports. To get the paths to projects and their last run IDs, use the polyspace-access -list-project command.

    example

    Examples

    collapse all

    If you follow a component-based development approach, you can assign analysis results by component to their respective owners.

    Get a list of projects currently stored on the Polyspace Access database and their last run IDs.

    polyspace-access -list-project -host myAccessServer 
    
    Connecting to https://example-access-server:9443
    Connecting as jsmith
    
    Get project list with the last Run Id
    Restricted/Code_Prover_Example (Code Prover) RUN_ID 14
    multimodule/vxWorks_demo (Code Prover) RUN_ID 16
    public/Bug_Finder_Example (Bug Finder) RUN_ID 24
    public/CP/Code_Prover_Example (Polyspace Code Prover) RUN_ID 8
    public/Polyspace (Code Prover) RUN_ID 28
    Command Completed

    Assign all red and orange run-time error results to the owner of all the files in Component_A of project vxWorks_demo. Perform the same assignment for the owner of Component_B. To specify the vxWorks_demo project, use the run ID.

    polyspace-access -set-unassigned-findings 16 ^
    -owner A_owner -source-contains Component_A ^
    -owner B_owner -source-contains Component_B ^
    -rte Red -rte Orange ^
    -host myAccessServer
    Using the option -source-contains Component_A matches all files with a file path that contains Component_A.

    -source-contains Component_B matches all files with a file path that contains Component_B, but excludes files with a file path that contains Component_A.

    Export the results and generate .csv files for each owner that contain the results assigned to them.

    polyspace-access -export 16 ^
    -output C:\Polyspace_Workspace\myResults.csv ^
    -output-per-owner ^
    -host myAccessServer
    The command generates file myResults.csv containing all results from the project with run ID 16. The command also generates files myResults.csv.A_owner.csv and myResults.csv.B_owner.csv on the same file path.

    Input Arguments

    collapse all

    Export Results

    Absolute path or run ID of the project results that you export specified as a string. Polyspace assigns a unique run ID to each analysis run you upload. If the path name includes spaces, use double quotes. To get the project results path or most recent run ID, use polyspace-access -list-project.

    Example: -export "public/Examples/Bug_Finder_Example (Bug Finder)"

    Example: -export 4

    Path to the file that stores the output of the command, specified as a string. If the path name includes spaces, use double quotes.

    Example: -output C:\Polyspace_Workspace\myResults.txt

    Example: -output "C:\Polyspace Workspace with Spaces\myResults.txt"

    Options to specify where to export results, and which subset of results you export. Use these options to export results to other tools you use to create custom reports or other custom review templates.

    You can also use a combination of options. For instance, using the option s -coding-rules -severity High exports coding rule violations that have been assigned a status of High in the Polyspace Access web interface.

    OptionDescription

    -output-per-owner

    Use this option to generate files that only contain results assigned to a particular user. The files are stored on the path you specify with -output <filePath>.

    For an example of how to assign results to owners at the command line, see Assign Results to Component Owners and Export Assigned Results.

    -rte All | Red | Gray | Orange | Green

    Type of RTE result to export specified as All, Red, Gray, Orange, or Green.

    To specify more than one argument, use the option for each argument.

    Example: -rte Red -rte Orange

    -defects All | High | Medium | Low

    Impact category of defect results to export specified as All, High, Medium, or Low.

    To specify more than one argument, use the option for each argument.

    Example: -defects Medium -defects Low

    -custom-coding-rules

    Export all custom coding rules results.

    -coding-rules

    Export all coding rules results.

    -code-metrics

    Export all code metrics results.

    -global-variables

    Export all global variables results.

    -status Unreviewed (default) | "To investigate" | "To fix" | "No action planned" | "Not a defect" | Other

    Review status of the results to export specified as Unreviewed (default), "To investigate", "To fix", Justified, "No action planned", "Not a defect", or Other.

    To specify more than one argument, use the option for each argument.

    Example: -status Tofix -status Toinvestigate

    -severity All | High | Medium | Low

    Severity of the results to export specified as All, High, Medium, or Low.

    To specify more than one argument, use the option for each argument.

    Example: -severity High -severity Low.

    -unassigned-findings

    Export all unassigned results.

    -open-findings-for-sqo 1 | 2 | 3 | 4 | 5 | 6

    Software quality objective or SQO level that must be satisfied specified as an SQO level from 1 to 6. If you specify an SQO level, polyspace-access -export open only results that must be fixed or justified to satisfy the requirements of the specified level.

    The SQO levels 1 to 6 specify an increasingly stricter set of predefined or user-defined requirements in terms of Polyspace results. To customize the requirements in the Polyspace Access web interface, see Customize Software Quality Objectives

    For more information on the SQO levels, see Evaluate Polyspace Bug Finder Results Against Bug Finder Quality Objectives (Polyspace Bug Finder).

    For example, SQO level 2 in Code Prover requires that you must not have unjustified red checks. This specification means that if you use -open-findings-for-sqo with a level higher than 2, all red checks are exported and must be subsequently fixed or justified. If you want to impose this requirement in the earlier SQO level 1, you can customize SQO level 1 in the Polyspace Access web interface.

    -resolution New | Fixed | Unresolved | Resolved

    Resolution corresponds to the type of comparison that the software performs between the current run and a baseline run that you specify with option -baseline. Use this option to compare two runs from the same project. The baseline run must be older than the current run.

    The resolution types are:

    • New — Results that are in the current run but not in the baseline run.

      If the project contains only one run, all results are new and you can omit this option.

    • Fixed — Results that are fixed in the current run, either because the result was fixed in the source code, or because the source code containing the result is deleted or no longer part of the analysis.

      If the project contains only one run, Polyspace issues an error.

    • Unresolved — Results from the baseline run that are still present in the current run.

      If the project contains only one run, Polyspace issues an error.

    • Resolved — Results that are Fixed in the current run or results with a status of Justified, No Action Planned, or Not A Defect in the current run.

      If the project contains only one run, Polyspace issues an error.

    If you do not specify a baseline, Polyspace compares the current run to the run that immediately precedes it.

    You can specify only one resolution type at a time. To export a comparison for multiple resolution types, run the polyspace-access -export command for each resolution type.

    See also Comparison Mode at the Command Line.

    -baseline <runID>

    Run ID of a run that you use as a baseline for comparison with a current run. This option requires option -resolution.

    If you do not specify a baseline, Polyspace compares the current run to the run that immediately precedes it. If the project contains only one run, Polyspace issues an error.

    See also Comparison Mode at the Command Line.

    -imported-reviews Not applied | Written | Overwritten | Unconfirmed

    Use this option to export a list of results from a project (target) whose review information was imported from another project (source). Specify one of these types of imports:

    • Not applied — Review information was imported from the source project but the review fields in the target project kept the original values.

    • Written — Review information from the source project was written to the target project only if the review fields in the target project were previously empty.

    • Overwritten — Review information from the source project was written to the target project even if the review fields in the target project were not previously empty.

    • Unconfirmed — Use this filter to select results that where the result of the import operation has not been confirmed by a reviewer. You confirm the result of the import operation in the Polyspace Access interface. See Confirm Imported Review Information.

    See also Import Review Information from Existing Polyspace Access Projects

    Connection Configuration

    Polyspace Access machine hostname that you specify in the URL of the Polyspace Access interface, such as https://hostname:portNumber/metrics/index.html. If you are unsure about which hostname to use, contact your Polyspace Access administrator.

    You must specify a hostname with all polyspace-access commands, except the -generate-migration-commands and -encrypt-password commands.

    Example: -host myAccessServer

    Port number that you specify in the URL of the Polyspace Access interface, such as https://hostname:portNumber/metrics/index.html. If you are unsure about which port number to use, contact your Polyspace Access administrator.

    HTTP protocol used to access Polyspace Access, specified as http or https.

    Full path to the text file where you store your login credentials. Use this option if you use a command that requires your Polyspace Access credentials in a script but you do not want to store your credentials in that script. While the script runs, someone inspecting currently running processes cannot see your credentials.

    You can store only one set of credentials in the file, either as -login and -encrypted-password entries on separate lines, for instance:

    -login jsmith
    -encrypted-password LAMMMEACDMKEFELKMNDCONEAPECEEKPL
    You can also store credentials as an -api-key entry:
    -api-key keyValue123
    Make sure that the file where you store your credentials is UTF-8 encoded and that you restrict the read and write permissions on the file. For example, to restrict read and write permissions on file login.txt in Linux®, use this command:
    chmod go-rwx login.txt

    API key you use as a login credential instead of providing your login and encrypted password. To assign an API key to a user, see Configure User Manager or contact your Polyspace Access administrator.

    Use the API key if you use a command that requires your Polyspace Access login credentials as part of an automation script with a CI tool such as Jenkins®. If a user updates their password, you do not need to update the API key associated with that user in your scripts.

    It is recommended that you store the API key in a text file and pass that file to the command by using the -credentials-file option.

    Login username that you use to interact with Polyspace Access.

    Use the options -login and -encryped-password together. If you do not use these two options together, you are prompted to enter your credentials at the command line, unless you use -api-key.

    Login password you use to interact with Polyspace Access. <ENCRYPTED_PASSWORD> is the output of the polyspace-access -encrypt-password command.

    Use the options -login and -encryped-password together. If you do not use these two options together, you are prompted to enter your credentials at the command line, unless you use the -api-key option.

    Number of times the polyspace-access command retries to upload results when you upload from a client machine to the server machine that hosts Polyspace Access before failing. Specify this option to retry the upload command in the event of sporadic network outages. The command waits 10 seconds between retries.

    Full path to command outputs.

    Path to the folder for storing temporary files generated by polyspace-access commands. The default folder path depends on your platform:

    • Windows — C:\Users\%username%\AppData\Local\Temp\ps_results_server

    • Linux — tmp/ps_results_server

    File path where you store the command output log. By default the command does not generate a log file.

    Version History

    Introduced in R2019a