From 8da8a3ea849ce636f766d1f1946dc31c4d05fffb Mon Sep 17 00:00:00 2001 From: Costin Zaharia <56015273+costin-zaharia-sonarsource@users.noreply.github.com> Date: Fri, 31 May 2024 17:08:01 +0200 Subject: [PATCH] Fix typo and insert space in nocompliant comments (#3952) --- rules/S1244/csharp/rule.adoc | 2 +- rules/S1694/csharp/rule.adoc | 4 ++-- rules/S3221/rule.adoc | 4 ++-- rules/S3254/rule.adoc | 4 ++-- rules/S3264/csharp/rule.adoc | 4 ++-- rules/S3955/rule.adoc | 4 ++-- rules/S5344/csharp/how-to-fix-it/aspnetframework.adoc | 2 +- rules/S6962/csharp/rule.adoc | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/rules/S1244/csharp/rule.adoc b/rules/S1244/csharp/rule.adoc index c198ce679c..97cc4ecf4c 100644 --- a/rules/S1244/csharp/rule.adoc +++ b/rules/S1244/csharp/rule.adoc @@ -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 { // ... } diff --git a/rules/S1694/csharp/rule.adoc b/rules/S1694/csharp/rule.adoc index 53c75dc64c..5e5a12e8da 100644 --- a/rules/S1694/csharp/rule.adoc +++ b/rules/S1694/csharp/rule.adoc @@ -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; diff --git a/rules/S3221/rule.adoc b/rules/S3221/rule.adoc index 10c148d185..5df7a67ab2 100644 --- a/rules/S3221/rule.adoc +++ b/rules/S3221/rule.adoc @@ -20,8 +20,8 @@ var leftLegs = //... for(var i = 0; i Happened; //Noncompliant + private event Action Happened; // Noncompliant public void RegisterEventHandler(Action handler) { - Happened += handler; //we register some event handlers + Happened += handler; // we register some event handlers } public void RaiseEvent() diff --git a/rules/S3955/rule.adoc b/rules/S3955/rule.adoc index 914e583f12..0c7dbe98ee 100644 --- a/rules/S3955/rule.adoc +++ b/rules/S3955/rule.adoc @@ -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 diff --git a/rules/S5344/csharp/how-to-fix-it/aspnetframework.adoc b/rules/S5344/csharp/how-to-fix-it/aspnetframework.adoc index 45f02bcc4d..26a3b3a737 100644 --- a/rules/S5344/csharp/how-to-fix-it/aspnetframework.adoc +++ b/rules/S5344/csharp/how-to-fix-it/aspnetframework.adoc @@ -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)); ---- diff --git a/rules/S6962/csharp/rule.adoc b/rules/S6962/csharp/rule.adoc index e6e7d332d6..d6a1ec63c0 100644 --- a/rules/S6962/csharp/rule.adoc +++ b/rules/S6962/csharp/rule.adoc @@ -35,7 +35,7 @@ public class FooController : Controller [HttpGet] public async Task Foo() { - using var client = new HttpClient(); //Noncompliant + using var client = new HttpClient(); // Noncompliant return await client.GetStringAsync(_url); } }