How to load an XML file for setting "code metrics" options at the command line.

조회 수: 3 (최근 30일)
jeremy longstreet
jeremy longstreet 2020년 12월 15일
편집: Anirban 2020년 12월 18일
I want to set these changes to the "Code Metrics":
<SQO ID="Custom-SQO-Level" ApplicableProduct="Code Prover" ApplicableProject="My_Project">
<path>1000</path>
<goto>0</goto>
<vg>20</vg>
<calls>12</calls>
<param>7</param>
<stmt>100</stmt>
<level>6</level>
<return>1</return>
<ap_cg_cycle>0</ap_cg_cycle>
</SQO>
This link shows how to create an XML file to set the SQO options:
This link shows how to utilize a file for MISRA but NOT Code Metrics:
for MISRA3 file loading:
polyspace-bug-finder -sources filename -misra3 from-file -checkers-selection-file misra_c_2012_rules.xml
How to load XML file for setting "Code Metrics" options in Polyspace-bug-finder at the command line?

답변 (1개)

Anirban Gangopadhyay
Anirban Gangopadhyay 2020년 12월 16일
편집: Anirban Gangopadhyay 2020년 12월 16일
Hi,
The difference between code metrics and the other checkers is that the thresholds/limits have to set after analysis, that is, during review. You cannot set the thresholds during analysis at the command line using officially documented options.
Depending on where you review the results, you can set the thresholds appropriately. The link:
Shows how to apply the thresholds in the deprecated Polyspace Metrics interface. In the Polyspace user interface, you can create a review scope to apply the thresholds (and share the review scope XML with others). See Compute Code Complexity Metrics for details.
If you are using the Polyspace Access web interface for review, you can do something similar using a custom SQO. See Customize Software Quality Objectives.
  댓글 수: 2
jeremy longstreet
jeremy longstreet 2020년 12월 16일
편집: jeremy longstreet 2020년 12월 16일
Thank you for your response.
How do I do this at the command line for generating reports than?
This question was asked here:
https://www.mathworks.com/matlabcentral/answers/417639-how-can-i-generate-a-polyspace-bug-finder-or-code-prover-report-which-includes-sqo-thresholds-from-c
But NOT answered in "how to change the set a custom review scope"?
Anirban
Anirban 2020년 12월 18일
편집: Anirban 2020년 12월 18일
Hi,
Currently, there is no easy way to do this at the command line. The answer here:
Refers to the deprecated Polyspace Metrics interface, and also involves an interactive step, where the SQO level is actually set in the Polyspace Metrics interface.
The generated reports produced with the polyspace-report-generator command use predefined templates (so that they are reliably consistent and cannot be tampered with). For customizing reports, the best bet is to export results
At that point, you can write a parser to remove lines with metrics results that are within the threshold.
This will involve a little bit of scripting. Please contact MathWorks Technical Support for helper scripts that can achieve this. In a very near release, computation of metrics that violate thresholds will be done during analysis and possible to trigger from command line.
There is an unofficial way to achieve what you want. You can create a Review Scope XML in the Polyspace user interface as documented in Compute Code Complexity Metrics . Then use the polyspace-report-generator command as documented, but with the additional option:
-wysiwyg scope_name
Here, scope_name is the name that appears in the Scope Name dropdown for the review scope, that is, the name that you give to your custom review scope.
This option will result only in exporting metrics values that are not filtered out by your custom review scope. (Note that for the option to work, the review scope XML should be saved in the current folder. )

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Generate Report에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by