code prover annotation for false positives

8 visualizaciones (últimos 30 días)
Bas Wielens
Bas Wielens el 1 de Feb. de 2018
Respondida: Lucas Lebert el 17 de Abr. de 2018
Hello,
we are using code prover for static analysis of our code. Some findings are false positives and I would like to exclude them for future runs. Code prover seem to have this possibility over annotations in our code. However, these do not work. I have tried:
  • /* polyspace<MISRA-C3:5.4:Not a defect:No action planned> "Comment" */
  • /* polyspace +1 MISRA-C3:5.4 [Justified] "Comment" */
None of them work, findings are still visible in the results.
What would be the correct syntax?
Thanks, Bas

Respuestas (1)

Lucas Lebert
Lucas Lebert el 17 de Abr. de 2018

Hi, Bas!

If you justify the defects in the code, Polyspace automatically sets the review settings of the defect in the results accordingly. By setting the severity to "Not a defect" as you did in your example, the results should match that.

You mentioned, that the defects are still visible. Indeed it is not possible to delete the defect completely from the results, it is only possible to justify the defect. It will still be visible there, but with the severity, status and the comment of your justification in the code.

With that being said another common mistake is that the justification in the code is not in the same line as the defect. You could justify the same defect in multiple lines of code by using the syntax /* polyspace:begin and /* polyspace:end, as described here: Review Comments

Have a great day! ~Lucas

Community Treasure Hunt

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

Start Hunting!

Translated by