Disabling warnings in D-Scanner: looking for suggestions
Dennis
dkorpel at gmail.com
Wed Mar 25 00:26:01 UTC 2020
On Tuesday, 24 March 2020 at 21:58:43 UTC, WebFreak001 wrote:
> sometimes this isn't possible very well (like long embedded
> strings)
You can split those string literals up and concatenate with ~,
though you do lose the convenience of a single embedded string
literal.
> often this happens when you explicitly make something not match
> style guidelines (UDA struct, ABI/mangling compatibility for
> some binding, etc)
Yes, that's when I run into this warning too.
> here is a "fix": a.length + -1
That's... actually not that bad, thanks! It doesn't really
express "I know this is unsigned, but it can't underflow" but if
it pleases D-Scanner, I might take it. :p
> for example PC-Lint includes some syntax like
> //lint e715 // disable "'argument' not referenced " for
> entire module
> //lint +e715 // enable "'argument' not referenced" again for
> module
> //lint --e(715) // disable 'argument' not referenced once
>
> however they have extremely complicated additional syntax too,
> but it's hard to look up this stuff.
If you sell it like that, it's an obvious no for me. Upon
encountering 'lint e715' it's not only unknown what kind of
warning the code 'e715' refers to, but 'lint' doesn't tell me
what reference I should use either.
Of course D-Scanner can do something elaborate better, but I
think suppressing warnings should be super simple. Maybe even
something as simple as `// stfu`, but then something like `//
warning: text explaining the warning` that binds to a declaration
/ statement using the same rules as Ddoc. D-Scanner only looks
for the 'warning:' part, and from context or the explanation text
it becomes clear what the raised warning would be.
You could mass-disable bindings in a module like this:
```
// warning: bindings do not adhere to D-style and are undocumented
module my.windows.bindings;
```
This scheme has a risk that a comment like this:
> warning: does not match style guide because it's a UDA
Would also suppress a valid 'missing documentation for public
symbol' warning.
And disabling all warnings for an entire module is blunt; some
users _will_ request a way to have granular control over it. I
don't think you can escape that. But I won't be one of those
users, so I don't have much to say there.
I hope some other people respond to this thread, it's pretty
quiet so far. Maybe few users actually use D scanner?
More information about the Digitalmars-d
mailing list