Good catch, it's a copy-paste error from another rule (still in
development). I'll fix this asap.
> Also, I'm getting a warning that I have an unused private field
> (FastPeersFlag) even though i'm using it in two separate methods. I
> get a similar warning for the other flags.
>
> http://anonsvn.mono-project.com/source/trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Messages/StandardMessages/HandshakeMessage.cs
ah it looks like I missed some cases...
what happens here is that the compilers turns *constant* fields into
values inside IL (let me know if the occurs to non-constant fields!)
E.g. you don't see a "LDFLD FastPeersFlag" but a "LDC_I4_4 +
CONV.I1" (or something like that, I did not compile it ;-)
Anyway this means Gendarme must look at all constants inside IL to see
if one of them match the constant fields. This is not a 100% safe
process (it could be a real 4 value not related to the, possible unused,
field) but it's better than the (current) alternative.
Thanks for the report!
Sebastien
Literals (like const) are now ignored[1] since it looking for their
value turned out too many false positives too.
Thanks again
Sebastien
[1] it turns out that fxcop does the same (i.e. ignoring them)
That would depend on the nested class, wouldn't it? Enumerators and the
whole async state machine stuff come to my mind, but I'm not firm enough
with the details here :-/
Best Regards, David