No issue is reported when […] it’s an initialization to -1, 0, 1, null, true, false, "" or string.Empty
Which, personally, I’d argue is a good exception for the rule. However, that doesn’t seem to be the case, as the rule is reported when setting variables to those values, as in this C# code:
Indeed, I misinterpreted “initialization” as “assignment”, sorry about that.
I still think those assignments (plus “++variable” and similar) can make code a bit clearer in some situations, even if they are technically useless, though that’s of course subjective, and the rule works as intended. I believe marking issues as “Accepted” only works in connected mode, so the only option when not connected would be to use #pragma warning disable (or just disable the rule entirely, which is not ideal), right? Does SonarQube have some mechanism to “tweak” rules, and is it possible to suggest an option to allow those exceptions?
We do have customisation of some rules via parameters, but unfortunately in this case, I believe the only solutions available for you are to disable the rule, or to use #pragma.
While we do have some rules that handle parameters to tweak the rules, doing so for every rule in every language isn’t fully viable. The current mechanism for handling rules that don’t quite fit, and aren’t applicable in certain contexts would be marking them as accepted where required.