Main Content

polyspace.DefectsOptions Class

Namespace: polyspace

Create custom list of defects to check

Description

Create a custom list of defects to check in a Polyspace® analysis.

Note

Before you run Polyspace from MATLAB®, you must link your Polyspace and MATLAB installations. See Integrate Polyspace with MATLAB and Simulink or Integrate Polyspace Server Products with MATLAB.

Construction

defectsList = polyspace.DefectsOptions creates the defect options object defectsList. You can customize the list of active defects by changing the properties.

Properties

An object is created with supported defects as properties. The defects are listed by their command-line name. See Short Names of Bug Finder Defect Groups and Defect Checkers.

By default, all defects are turned off. To turn on a defect, set the defect to true. For example:

defectsList = polyspace.DefectsOptions;
defectsList.FLOAT_ZERO_DIV = true;

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects.

Examples

collapse all

Customize the list of defects checked during a Polyspace Bug Finder analysis.

Create two objects: a polyspace.DefectsOptions object for setting coding rules and a polyspace.Project object for running the Polyspace analysis.

defectsList = polyspace.DefectsOptions;
proj = polyspace.Project;

Enable the numerical defects.

defectsList.FLOAT_ZERO_DIV = true;
defectsList.INT_ZERO_DIV = true;
defectsList.FLOAT_ABSORPTION = true;
defectsList.BITWISE_NEG = true;
defectsList.FLOAT_CONV_OVFL = true;
defectsList.FLOAT_OVFL = true;
defectsList.INT_CONV_OVFL = true;
defectsList.INT_OVFL = true;
defectsList.FLOAT_STD_LIB = true;
defectsList.INT_STD_LIB = true;
defectsList.SHIFT_NEG = true;
defectsList.SHIFT_OVFL = true;
defectsList.SIGN_CHANGE = true;
defectsList.UINT_CONV_OVFL = true;
defectsList.UINT_OVFL = true;
defectsList.BAD_PLAIN_CHAR_USE = true;

Add the customized list of defects to the Configuration property of the polyspace.Project object.

proj.Configuration.BugFinderAnalysis.CheckersList = defectsList;
proj.Configuration.BugFinderAnalysis.CheckersPreset = 'custom';

You can now use the polyspace.Project object to run the analysis.

Version History

Introduced in R2016b