New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mosify rule S2198: Add C# #1534
Conversation
SonarQube Quality Gate for 'rspec-tools' |
SonarQube Quality Gate for 'rspec-frontend' |
rules/S2198/csharp/rule.adoc
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |
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 |
rules/S2198/csharp/rule.adoc
Outdated
include::../rule.adoc[] | ||
Certain mathematical comparisons will always return the same value, and should simply not be made. | ||
|
||
These comparisons will always return ``++false++``: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comparisons will always return ``++false++``: | |
These comparisons will always return `false`: |
rules/S2198/csharp/rule.adoc
Outdated
|
||
These comparisons will always return ``++false++``: | ||
|
||
* comparing a `char` with a numeric constant that's outside the `char` range |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The convention is to start with an upper letter and to end with a dot:
* comparing a `char` with a numeric constant that's outside the `char` range | |
* Comparing a `char` with a numeric constant that's outside the `char` range. |
rules/S2198/csharp/rule.adoc
Outdated
float f = 42.0f; | ||
const double d = double.MaxValue; | ||
if (f <= d) { } // Noncompliant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simpler:
float f = 42.0f; | |
const double d = double.MaxValue; | |
if (f <= d) { } // Noncompliant | |
float f = 42.0f; | |
if (f <= double.MaxValue) { } // Noncompliant |
rules/S2198/csharp/rule.adoc
Outdated
|
||
These comparisons will always return ``++false++``: | ||
|
||
* comparing a `char` with a numeric constant that's outside the `char` range |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better like so?
* comparing a `char` with a numeric constant that's outside the `char` range | |
* Comparing a `char` with a numeric constant that is outside of the range of `char`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"always false" is not correct.
rules/S2198/csharp/rule.adoc
Outdated
include::../rule.adoc[] | ||
Certain mathematical comparisons will always return the same value, and should simply not be made. | ||
|
||
These comparisons will always return `false`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comparisons will always return `false`: | |
These comparisons will return either always `true` or always `false` depending on the kind of comparison: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please merge once 🟢 .
5f84ea1
to
40f7740
Compare
SonarQube Quality Gate for 'rspec-tools' |
SonarQube Quality Gate for 'rspec-frontend' |
Hi @gregory-paidis-sonarsource |
Hey @arseniy-sonar , thanks for reminding me, I will follow the procedure from now on. |
Rule implementation: SonarSource/sonar-dotnet#6658