Sample Report Template Customizations
A report template defines the content and formatting of reports generated from analysis results. If an existing template does not suit your requirements, you can change certain aspects of the template.
This topic shows some customizations you can do to a Polyspace® report template, with brief steps. For a more detailed tutorial, see Customize Existing Code Prover Report Template.
To customize a template:
Open MATLAB® Report Generator™. At the MATLAB command prompt, enter:
report
Open an existing template.
The templates are located in
.polyspaceroot
/toolbox/polyspace/psrptgen/templates
is the Polyspace installation folder.polyspaceroot
Add, remove, or modify components of the template.
For a full list of Polyspace-specific components, see Generate Reports.
Add List of Recursive Functions
Suppose that you want to report all recursive functions detected in your source code.
Start from the CodeMetrics template. In the chapter on code
metrics, add the component Recursive Functions
.
When you generate a report by using the modified template, you see a table with the list of recursive functions.
Show Red Run-Time Checks Only
Suppose that you want to report an overview of all run-time checks and details for red checks only.
Start from the Developer template. Remove all chapters, except the ones containing these components:
Run-time Checks Details Ordered by Color/File
. Modify this component so that it shows red checks only.Select the component. On the right pane, in the group Categories To Include, clear all boxes other than Red Checks.
Appendix components:
Configuration Parameters
andAcronym Definitions
.
When you generate a report by using the modified template, you see an overview of checks, a chapter with details for red checks only, and the appendix.
Show Non-Justified Run-Time Checks Only
Suppose that you want to report only the checks that you have not justified. You justify a check when you assign one of these statuses:
Justified
No action planned
Not a defect
Add the component Report Customization (Filtering)
above the first chapter. Modify the
component so that the following chapters show non-justified checks only.
Select the component. On the right pane, in the group Advanced
Filters, from the Justification Status list,
select Un-justified
.
When you generate a report by using the modified template, you see only the non-justified run-time checks.
Add Chapter for Functional Design Errors
Suppose that you implement functional design testing using
assert
statements in your code. For instance, to test if the
output of a function out
is within a range
[MIN,MAX]
, your code uses the statement:
assert(MIN <= out && out <= MAX);
User assertion
to determine if the
assert
condition fails. Suppose that you want to report these
checks in a separate chapter because they are different from the other run-time
error checks.Start from the Developer template. Make a copy of the chapter
containing the component Run-time Checks Details Ordered by Color/File
.
Rename each of the two chapter titles so that you can distinguish between them. In each chapter, modify the component Run-time Checks Details Ordered by Color/File as follows:
In one chapter, exclude User assertion checks. Select the component. On the right pane, in the group Advanced Filters, for Check types to include, enter:
^(?!User assertion).*
In the other chapter, include User assertion checks. Select the component. On the right pane, in the group Advanced Filters, for Check types to include, enter:
Clear the boxes for gray checks, because the User assertion checks cannot be gray.User assertion
When you generate a report by using the modified template, you see two copies of the chapter on run-time checks. The first chapter contains all checks other than User assertion checks and the second chapter contains User assertion checks only.