Skip to content

Commit

Permalink
Small formatting changes on S2198
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-paidis-sonarsource committed Feb 15, 2023
1 parent 0da98aa commit aaa03f4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions rules/S2198/csharp/rule.adoc
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
Certain mathematical comparisons will always return the same value, and should simply not be made.

These comparisons will always return ``++false++``:
These comparisons will always return `false`:

* comparing a `char` with a numeric constant that's outside the `char` range
* comparing a `float` with a numeric constant that's outside the `float` range
* comparing a `long` with a numeric constant that's outside the `long` range
* comparing a `ulong` with a numeric constant that's outside the `ulong` range
* Comparing a `char` with a numeric constant that is outside of the range of `char`.
* Comparing a `float` with a numeric constant that is outside of the range of `float`.
* Comparing a `long` with a numeric constant that is outside of the range of `long`.
* Comparing a `ulong` with a numeric constant that is outside of the range of `ulong`.
== Noncompliant Code Example

[source,text]
----
float f = 42.0f;
const double d = double.MaxValue;
if (f <= d) { } // Noncompliant
if (f <= double.MaxValue) { } // Noncompliant
----

ifdef::env-github,rspecator-view[]
Expand Down

0 comments on commit aaa03f4

Please sign in to comment.