Skip to content

Commit

Permalink
Fix typo and insert space in nocompliant comments (#3952)
Browse files Browse the repository at this point in the history
  • Loading branch information
costin-zaharia-sonarsource authored May 31, 2024
1 parent dad239b commit 8da8a3e
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion rules/S1244/csharp/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
// ...
}
Expand Down
4 changes: 2 additions & 2 deletions rules/S1694/csharp/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions rules/S3221/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions rules/S3254/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
----


Expand Down
4 changes: 2 additions & 2 deletions rules/S3264/csharp/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions rules/S3955/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rules/S5344/csharp/how-to-fix-it/aspnetframework.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
----

Expand Down
2 changes: 1 addition & 1 deletion rules/S6962/csharp/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 8da8a3e

Please sign in to comment.