Disabling warnings in D-Scanner: looking for suggestions

SHOO zan77137 at nifty.com
Sat Mar 28 19:40:49 UTC 2020


On Monday, 23 March 2020 at 13:15:08 UTC, WebFreak001 wrote:
> What kind of suppression system would you prefer to see in 
> D-Scanner, what would you prefer not to see? Open for 
> suggestions.

I am working in C using MISRA-C static analysis.
According to the findings made there, the suppression of warnings 
by comments is definitely necessary.
Too many warnings can discourage developers and bury important 
warnings.

In MISRA-C, daring to ignore warnings is called "deviation". And 
to deviate, a deviation report is required.
Even in the D-Scanner lint, a statement of reasons seems to be 
necessary for suppression.

In addition, there are three code units that require suppression
- File unit suppression: For example, binding would fall under 
this category.
```
     // @dscanner suppress(suspicious.unmodified, "some reasons")
     foo();
```
- Block unit suppression: Wrapping multiple warnings in a single 
function can be useful in consolidating the areas that need 
attention.
```
     void foo() {
         // @dscanner suppress(suspicious.unmodified, "some 
reasons")
         hoge();
         fuga();
         piyo();
         // @dscanner unsuppress(suspicious.unmodified)
     }
```
- Line unit suppression: This is useful when suppressing a single 
warning. (but I don't like this, because lines tend to be longer 
and less readable; I prefer block unit suppression over line unit 
suppression, even if it is for a single line.)
```
      foo(); // @dscanner-suppress(suspicious.unmodified, "some 
reasons")
```




More information about the Digitalmars-d mailing list