rspec/rules/S1764/csharp/rule.adoc
2020-12-23 14:59:06 +01:00

35 lines
556 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
----
if ( a == a ) // always true
{
doZ();
}
if ( a != a ) // always false
{
doY();
}
if ( a == b && a == b ) // if the first one is true, the second one is too
{
doX();
}
if ( a == b || a == b ) // if the first one is true, the second one is too
{
doW();
}
int j = 5 / 5; //always 1
int k = 5 - 5; // always 0
c.Equals(c); //always true
Object.Equals(c, c); //always true
----
== Exceptions
This rule ignores ``*``, ``+``, ``=``, ``<<``, and ``>>``.
include::../see.adoc[]