Hello,
does anyone know how to justify HIS findings in code?
I have tried:
/* polyspace<Custom:Language Scope:Not a defect:Justify with annotations> The code is difficult because it's highly optimized. */
/* polyspace<Custom Number of Called Functions:Not a defect:Justify with annotations> The amout of called functions is necessary due to readability and functionality */
/* polyspace<Custom VOCF:Not a defect:Justify with annotations> The amout of called functions is necessary due to readability and functionality */
But with no luck.
I know that normally I use the same format of comment with MISRA or RTE findings.
I am using polyspace check for C++ code.

 채택된 답변

Anirban
Anirban 2022년 10월 12일

1 개 추천

You have to use:
/* polyspace CODE-METRICS: VOCF [Not a defect:Low] The amount of called functions is necessary due to readability and functionality */
.

댓글 수: 6

Hello, so i have tried but with no effect, any solution?
Did you place the comment beside the function name in the definition?
Here is an example that justifies the language scope for function f :
int g(int);
int f(int i) /* polyspace CODE-METRIC:VOCF [No action planned:Low] "The amount of called functions is necessary due to readability and functionality." */
{
if (i == 1)
return i;
else
return i * g(i-1);
}
Svatopluk
Svatopluk 2022년 11월 15일
Well the finding is for line 0 of the code, lots of the errors are detected at the 1st line. In that case is hard to tell where it should be justified.
Anirban
Anirban 2022년 11월 15일
편집: Anirban 2022년 11월 22일
The code metrics are either project, file or function metrics. See the various types of metrics here.
File metrics appear at the beginning of a file (and cannot be justified). Function metrics appear next to the function signature in the definition and should be justified there.
Svatopluk
Svatopluk 2022년 11월 22일
Thanks, do you have any example? From 15th i am trying to justify file metrics, on the 1st line, with the string format is you have suggested, but with no luck ( Language Scope, anf number of called functions)
Correcting my previous answer: it seems file metrics cannot be justified. However, language scope and number of called functions are function metrics, not file metrics, and should be justifiable. For instance, you can try the example below and see that the language scope is justified:
int g(int);
int f(int i) /* polyspace CODE-METRIC:VOCF [No action planned:Low] "The amount of called functions is necessary due to readability and functionality." */
{
if (i == 1)
return i;
else
return i * g(i-1);
}
About the reason why language scope and number of called functions are coming at the beginning of the file instead of next to a function definiton, I am not sure. Please contact MathWorks Technical Support for more help with the problem: https://www.mathworks.com/support/contact_us.html

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

추가 답변 (0개)

질문:

2022년 10월 5일

편집:

2022년 11월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by