Fix typo and insert space in nocompliant comments (#3952)
This commit is contained in:
parent
dad239b488
commit
8da8a3ea84
@ -28,7 +28,7 @@ Consider using a small tolerance value to check if the numbers are "close enough
|
||||
----
|
||||
float myNumber = 3.146f;
|
||||
|
||||
if (myNumber == 3.146f) //Noncompliant: due to floating point imprecision, this will likely be false
|
||||
if (myNumber == 3.146f) // Noncompliant: due to floating point imprecision, this will likely be false
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
@ -12,13 +12,13 @@ A ``++class++`` with only ``++abstract++`` methods and no inheritable behavior s
|
||||
|
||||
[source,csharp]
|
||||
----
|
||||
public abstract class Animal //Noncompliant; should be an interface
|
||||
public abstract class Animal // Noncompliant; should be an interface
|
||||
{
|
||||
abstract void Move();
|
||||
abstract void Feed();
|
||||
}
|
||||
|
||||
public abstract class Color //Noncompliant; should be concrete with a protected constructor
|
||||
public abstract class Color // Noncompliant; should be concrete with a protected constructor
|
||||
{
|
||||
private int red = 0;
|
||||
private int green = 0;
|
||||
|
@ -20,8 +20,8 @@ var leftLegs = //...
|
||||
|
||||
for(var i = 0; i<rightLegs.Count; i++)
|
||||
{
|
||||
var rightLeg = rightLegs[i]; //Noncompliant
|
||||
var leftLeg = leftLegs[i]; //Noncompliant
|
||||
var rightLeg = rightLegs[i]; // Noncompliant
|
||||
var leftLeg = leftLegs[i]; // Noncompliant
|
||||
if (leftLeg.Length != rightLeg.Length)
|
||||
{
|
||||
//... unlucky
|
||||
|
@ -10,8 +10,8 @@ Specifying the default parameter values in a method call is redundant. Such valu
|
||||
public void M(int x, int y=5, int z = 7) { /* ... */ }
|
||||
|
||||
// ...
|
||||
M(1, 5); //Noncompliant, y has the default value
|
||||
M(1, z: 7); //Noncompliant, z has the default value
|
||||
M(1, 5); // Noncompliant, y has the default value
|
||||
M(1, z: 7); // Noncompliant, z has the default value
|
||||
----
|
||||
|
||||
|
||||
|
@ -9,11 +9,11 @@ Events that are not invoked anywhere are dead code, and there's no good reason t
|
||||
----
|
||||
class UninvokedEventSample
|
||||
{
|
||||
private event Action<object, EventArgs> Happened; //Noncompliant
|
||||
private event Action<object, EventArgs> Happened; // Noncompliant
|
||||
|
||||
public void RegisterEventHandler(Action<object, EventArgs> handler)
|
||||
{
|
||||
Happened += handler; //we register some event handlers
|
||||
Happened += handler; // we register some event handlers
|
||||
}
|
||||
|
||||
public void RaiseEvent()
|
||||
|
@ -7,9 +7,9 @@ There is no point in creating a branch in the code only to execute an empty stat
|
||||
|
||||
[source,text]
|
||||
----
|
||||
if(foo); //Noncompliant, the semi-colon must be removed
|
||||
if(foo); // Noncompliant, the semi-colon must be removed
|
||||
trigger(action1); // executes unconditionally
|
||||
else if (bar); //Noncompliant, the semi-colon must be removed
|
||||
else if (bar); // Noncompliant, the semi-colon must be removed
|
||||
trigger(action2); // executes unconditionally
|
||||
|
||||
while (condition); // Noncompliant
|
||||
|
@ -34,7 +34,7 @@ using System.Security.Cryptography;
|
||||
RNGCryptoServiceProvider rngCsp = new RNGCryptoServiceProvider();
|
||||
byte[] salt = new byte[32];
|
||||
rngCsp.GetBytes(salt);
|
||||
Rfc2898DeriveBytes kdf = new Rfc2898DeriveBytes(password, salt, 100_000, HashAlgorithmName.SHA256); // Noncompliant
|
||||
Rfc2898DeriveBytes kdf = new Rfc2898DeriveBytes(password, salt, 100_000, HashAlgorithmName.SHA256); // Compliant
|
||||
string hashed = Convert.ToBase64String(kdf.GetBytes(256 / 8));
|
||||
----
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class FooController : Controller
|
||||
[HttpGet]
|
||||
public async Task<string> Foo()
|
||||
{
|
||||
using var client = new HttpClient(); //Noncompliant
|
||||
using var client = new HttpClient(); // Noncompliant
|
||||
return await client.GetStringAsync(_url);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user