upvote
I try to keep to that, but sometimes the flag is turning on a negative feature, disabling that which is the default and will remain so for compatibility reasons.

Sometimes it is worth the effort of going through and changing the logic elsewhere to keep the boolean positive, sometimes that would be too much effort to retest at the time.

Another option I like, when I have a config object interpreting things so I'm reading doing `if (config.IsWhateverThatThingIsEnabled)` then I can just have paired properties to pick from when I want to check IsEnabled or IsDisabled.

I've come across code where there is an overide for an option to disable something and the naming plus the logical not really make you think about what is happening…

    if (!OverrideDisabledOptionToBlockAction) {}
reply
Agree. And I've been flagging double negatives in PRs for years (e.g. `not undead`). It makes me feel like the Ned Flanders of programmers.

But RuboCop detects `!!something`, and I actually like that idiom, because I prefer to convert into true boolean types before passing them to a method, since it makes the intention clear in the code.

reply