rspec/rules/S1764/csharp/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

59 lines
1.0 KiB
Plaintext

== Why is this an issue?
include::../description.adoc[]
=== Noncompliant code example
[source,csharp]
----
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[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
* Correct one of the identical expressions on both sides of operator '{0}'.
* Change one instance of '{0}' to a different value; comparing '{0}' to itself always returns true.
include::../highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]