This rule simply finds all the places where a boolean value is compared to a boolean constant. I've fought with a number of people on this issue and have always fallen back to the idea that the closer your code is to English (or whatever language) the better. Read the following code:
if (isRaining == true)
I would read it as "if it is raining is true then...". Now read this:
if (isRaining)
I would read it as "if it is raining then...". If you talk like this is true then you should probably not use this rule. ;-)

This shouldn't make any difference in the compiled code since the compiler throws away the "useless" boolean constant.

Last edited Feb 22, 2009 at 6:32 PM by JeffLeBert, version 1

Comments

No comments yet.