Squore provides a violation relaxation mechanism that is triggered via comments found in the source code itself. There are two pre-requisites for relaxation to work:
The model used to analyse your source code must implement a special rule called R_RELAX for relaxation to take place.
You need to know the mnemonic of the violated rule you want to relax, in order to use it as a key in your comment.
Squore interprets comments formatted in one of these three ways:
Inline Relaxation
This syntax is used to relax violations on the current line.
some code; /* %RELAX<keys> : Text to justify the relaxation */
Relax Next Line
This syntax is used to relax a violation on the first following line that is not a comment. In the example the text of the justification will be: "Text to justify the relaxation the text of the justification continues while lines are made of comments only"
/* >RELAX<keys> : Text to justify the relaxation */ /* the text of the justification continues while */ /* lines are made of comments only */ some code;
Block Relaxation
This syntax is used to relax violations in an entire block of code.
/* {{ RELAX<keys> : Text to justify the relaxation */ /* like for format 2 text can be on more than one line */ int my_func() { /* contains many violations */ ... } /* }} RELAX<keys> */
<keys> can be one of the following:
<*>: relax all violations
<MNEMO>: relax violations of the rule MNEMO
<MNEMO1,MNEMO2,...,MNEMOn>: relax violations of rules MNEMO1 and MNEMO2 ... and MNEMOn
The relaxed violations are still shown in the Findings page after the next analysis, but they appear under the rule R_RELAX, showing the mnemonic of the relaxed violation and the justification text.
As an example, this is how you would relax the violations of the rule Backward goto for Adherence to 'Analysability' Standards in Neptune:
click the violation of Backward goto on the Findings page to find the rule's mnemonic (BWGOTO) and the location of the finding (DB5_backup.c line 52).
Edit the code of the sample project to relax the violation as shown below.
goto loopwrite; /* %RELAX<BWGOTO> : This backward goto is acceptable in our code. */
Create a new version of the project.
On the Findings page, the violation now visible if you select to display derogations in the filter: