From c30f95a0863bcf60a2ffb66e64cb4b23b5f9bf1f Mon Sep 17 00:00:00 2001 From: Vincent Marmin <3215889+vincent314@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:56:33 +0100 Subject: [PATCH 1/2] feat: rename rule keys from ECXXX to GCIXXX --- .../EC83.ReplaceEnumToStringWithNameOf.cs | 28 ------ ...CI69.DontCallFunctionsInLoopConditions.cs} | 4 +- ...=> GCI72.DontExecuteSqlCommandsInLoops.cs} | 10 +- ...=> GCI75.DontConcatenateStringsInLoops.cs} | 62 ++++++------ ...Layout.cs => GCI81.SpecifyStructLayout.cs} | 6 +- ....cs => GCI82.VariableCanBeMadeConstant.cs} | 10 +- .../GCI83.ReplaceEnumToStringWithNameOf.cs | 28 ++++++ ...hods.cs => GCI84.AvoidAsyncVoidMethods.cs} | 4 +- ...eTypeSealed.cs => GCI85.MakeTypeSealed.cs} | 96 +++++++++---------- ...cs => GCI86.GCCollectShouldNotBeCalled.cs} | 12 +-- ...ListIndexer.cs => GCI87.UseListIndexer.cs} | 18 ++-- ... => GCI88.DisposeResourceAsynchronusly.cs} | 4 +- ...erBy.cs => GCI91.UseWhereBeforeOrderBy.cs} | 8 +- ...s => GCI92.UseLengthToTestEmptyStrings.cs} | 2 +- ...irectly.cs => GCI93.ReturnTaskDirectly.cs} | 6 +- 15 files changed, 149 insertions(+), 149 deletions(-) delete mode 100644 RuleTests/EcoCode/EC83.ReplaceEnumToStringWithNameOf.cs rename RuleTests/EcoCode/{EC69.DontCallFunctionsInLoopConditions.cs => GCI69.DontCallFunctionsInLoopConditions.cs} (88%) rename RuleTests/EcoCode/{EC72.DontExecuteSqlCommandsInLoops.cs => GCI72.DontExecuteSqlCommandsInLoops.cs} (62%) rename RuleTests/EcoCode/{EC75.DontConcatenateStringsInLoops.cs => GCI75.DontConcatenateStringsInLoops.cs} (77%) rename RuleTests/EcoCode/{EC81.SpecifyStructLayout.cs => GCI81.SpecifyStructLayout.cs} (70%) rename RuleTests/EcoCode/{EC82.VariableCanBeMadeConstant.cs => GCI82.VariableCanBeMadeConstant.cs} (69%) create mode 100644 RuleTests/EcoCode/GCI83.ReplaceEnumToStringWithNameOf.cs rename RuleTests/EcoCode/{EC84.AvoidAsyncVoidMethods.cs => GCI84.AvoidAsyncVoidMethods.cs} (73%) rename RuleTests/EcoCode/{EC85.MakeTypeSealed.cs => GCI85.MakeTypeSealed.cs} (77%) rename RuleTests/EcoCode/{EC86.GCCollectShouldNotBeCalled.cs => GCI86.GCCollectShouldNotBeCalled.cs} (74%) rename RuleTests/EcoCode/{EC87.UseListIndexer.cs => GCI87.UseListIndexer.cs} (79%) rename RuleTests/EcoCode/{EC88.DisposeResourceAsynchronusly.cs => GCI88.DisposeResourceAsynchronusly.cs} (89%) rename RuleTests/EcoCode/{EC91.UseWhereBeforeOrderBy.cs => GCI91.UseWhereBeforeOrderBy.cs} (82%) rename RuleTests/EcoCode/{EC92.UseLengthToTestEmptyStrings.cs => GCI92.UseLengthToTestEmptyStrings.cs} (86%) rename RuleTests/EcoCode/{EC93.ReturnTaskDirectly.cs => GCI93.ReturnTaskDirectly.cs} (94%) diff --git a/RuleTests/EcoCode/EC83.ReplaceEnumToStringWithNameOf.cs b/RuleTests/EcoCode/EC83.ReplaceEnumToStringWithNameOf.cs deleted file mode 100644 index 5123308..0000000 --- a/RuleTests/EcoCode/EC83.ReplaceEnumToStringWithNameOf.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace RuleTests.EcoCode; - -internal static class ReplaceEnumToStringWithNameOf -{ - private enum MyEnum { A, B, C, D } - - public static void Run() - { - Console.WriteLine(nameof(MyEnum.A)); - Console.WriteLine(nameof(MyEnum.B)); - Console.WriteLine(nameof(MyEnum.C)); - Console.WriteLine(nameof(MyEnum.D)); - - Console.WriteLine(MyEnum.A.ToString()); // EC83, code fix: nameof(MyEnum.A) - Console.WriteLine(MyEnum.B.ToString("")); // EC83, code fix: nameof(MyEnum.B) - Console.WriteLine(MyEnum.C.ToString(string.Empty)); // EC83, code fix: nameof(MyEnum.C) - Console.WriteLine(MyEnum.D.ToString(format: null)); // EC83, code fix: nameof(MyEnum.D) - - Console.WriteLine(MyEnum.A.ToString("G")); // EC83, code fix: nameof(MyEnum.A) - Console.WriteLine(MyEnum.B.ToString("F")); // EC83, code fix: nameof(MyEnum.B) - Console.WriteLine(MyEnum.C.ToString("N")); - - Console.WriteLine($"{MyEnum.A}"); // EC83, code fix: nameof(MyEnum.A) - Console.WriteLine($"{MyEnum.B:G}"); // EC83, code fix: nameof(MyEnum.B) - Console.WriteLine($"{MyEnum.C:F}"); // EC83, code fix: nameof(MyEnum.C) - Console.WriteLine($"{MyEnum.D:N}"); - } -} diff --git a/RuleTests/EcoCode/EC69.DontCallFunctionsInLoopConditions.cs b/RuleTests/EcoCode/GCI69.DontCallFunctionsInLoopConditions.cs similarity index 88% rename from RuleTests/EcoCode/EC69.DontCallFunctionsInLoopConditions.cs rename to RuleTests/EcoCode/GCI69.DontCallFunctionsInLoopConditions.cs index 6fa238c..12228ab 100644 --- a/RuleTests/EcoCode/EC69.DontCallFunctionsInLoopConditions.cs +++ b/RuleTests/EcoCode/GCI69.DontCallFunctionsInLoopConditions.cs @@ -13,7 +13,7 @@ public static void Run(int p) { int i, j = 0, k = 10; - // EC69 on V2(), V3(k), V3(p) and V3(C) + // GCI69 on V2(), V3(k), V3(p) and V3(C) for (i = 0; i < V1 && i < V2() && i < V3(i) && i < V3(j) && i < V3(k) && i < V3(p) && i < V3(C); i++) j += i; @@ -25,7 +25,7 @@ public static void Run(int p) while (i < V1 && i < V2() && i < V3(i) && i < V3(j) && i < V3(k) && i < V3(p) && i < V3(C)); string? d = Path.GetDirectoryName("toto"); - while (d != null && !d.Equals(@"S:\", StringComparison.OrdinalIgnoreCase)) // No EC69, d is reassigned in the loop + while (d != null && !d.Equals(@"S:\", StringComparison.OrdinalIgnoreCase)) // No GCI69, d is reassigned in the loop d = Path.GetDirectoryName(d); } } diff --git a/RuleTests/EcoCode/EC72.DontExecuteSqlCommandsInLoops.cs b/RuleTests/EcoCode/GCI72.DontExecuteSqlCommandsInLoops.cs similarity index 62% rename from RuleTests/EcoCode/EC72.DontExecuteSqlCommandsInLoops.cs rename to RuleTests/EcoCode/GCI72.DontExecuteSqlCommandsInLoops.cs index cea4fd6..cae2c49 100644 --- a/RuleTests/EcoCode/EC72.DontExecuteSqlCommandsInLoops.cs +++ b/RuleTests/EcoCode/GCI72.DontExecuteSqlCommandsInLoops.cs @@ -6,7 +6,7 @@ internal static class DontExecuteSqlCommandsInLoops { public static void Run() { - var command = default(IDbCommand)!; // EC82, code fix: const IDbCommand command = default!; + var command = default(IDbCommand)!; // GCI82, code fix: const IDbCommand command = default!; _ = command.ExecuteNonQuery(); _ = command.ExecuteScalar(); _ = command.ExecuteReader(); @@ -14,10 +14,10 @@ public static void Run() for (int i = 0; i < 10; i++) { - _ = command.ExecuteNonQuery(); // EC72 - _ = command.ExecuteScalar(); // EC72 - _ = command.ExecuteReader(); // EC72 - _ = command.ExecuteReader(CommandBehavior.Default); // EC72 + _ = command.ExecuteNonQuery(); // GCI72 + _ = command.ExecuteScalar(); // GCI72 + _ = command.ExecuteReader(); // GCI72 + _ = command.ExecuteReader(CommandBehavior.Default); // GCI72 } } } diff --git a/RuleTests/EcoCode/EC75.DontConcatenateStringsInLoops.cs b/RuleTests/EcoCode/GCI75.DontConcatenateStringsInLoops.cs similarity index 77% rename from RuleTests/EcoCode/EC75.DontConcatenateStringsInLoops.cs rename to RuleTests/EcoCode/GCI75.DontConcatenateStringsInLoops.cs index 83e0e1a..9a30367 100644 --- a/RuleTests/EcoCode/EC75.DontConcatenateStringsInLoops.cs +++ b/RuleTests/EcoCode/GCI75.DontConcatenateStringsInLoops.cs @@ -11,18 +11,18 @@ public static void DontConcatenateStringsWithParameterAllLoops(string sParam) for (int i = 0; i < 10; i++) { string si = $"{i}"; - sParam += si; // EC75 - sParam = sParam + si; // EC75 - sParam = si + sParam; // EC75 + sParam += si; // GCI75 + sParam = sParam + si; // GCI75 + sParam = si + sParam; // GCI75 sParam = si + si; } foreach (int i in Enumerable.Range(0, 10)) { string si = $"{i}"; - sParam += si; // EC75 - sParam = sParam + si; // EC75 - sParam = si + sParam; // EC75 + sParam += si; // GCI75 + sParam = sParam + si; // GCI75 + sParam = si + sParam; // GCI75 sParam = si + si; } @@ -30,9 +30,9 @@ public static void DontConcatenateStringsWithParameterAllLoops(string sParam) while (i2++ < 10) { string si = $"{i2}"; - sParam += si; // EC75 - sParam = sParam + si; // EC75 - sParam = si + sParam; // EC75 + sParam += si; // GCI75 + sParam = sParam + si; // GCI75 + sParam = si + sParam; // GCI75 sParam = si + si; } @@ -40,9 +40,9 @@ public static void DontConcatenateStringsWithParameterAllLoops(string sParam) do { string si = $"{i2}"; - sParam += si; // EC75 - sParam = sParam + si; // EC75 - sParam = si + sParam; // EC75 + sParam += si; // GCI75 + sParam = sParam + si; // GCI75 + sParam = si + sParam; // GCI75 sParam = si + si; } while (++i2 < 10); } @@ -54,9 +54,9 @@ public static void DontConcatenateStringsWithField() for (int i = 0; i < 10; i++) { string si = $"{i}"; - sField += si; // EC75 - sField = sField + si; // EC75 - sField = si + sField; // EC75 + sField += si; // GCI75 + sField = sField + si; // GCI75 + sField = si + sField; // GCI75 sField = si + si; } } @@ -67,9 +67,9 @@ public static void DontConcatenateStringsWithProperty() for (int i = 0; i < 10; i++) { string si = $"{i}"; - sProp += si; // EC75 - sProp = sProp + si; // EC75 - sProp = si + sProp; // EC75 + sProp += si; // GCI75 + sProp = sProp + si; // GCI75 + sProp = si + sProp; // GCI75 sProp = si + si; } } @@ -80,9 +80,9 @@ public static void DontConcatenateStringsWithLocal() for (int i = 0; i < 10; i++) { string si = $"{i}"; - sLocal += si; // EC75 - sLocal = sLocal + si; // EC75 - sLocal = si + sLocal; // EC75 + sLocal += si; // GCI75 + sLocal = sLocal + si; // GCI75 + sLocal = si + sLocal; // GCI75 sLocal = si + si; string sLocalInLoop = string.Empty; @@ -105,26 +105,26 @@ public static void DontConcatenateStringsWithForEach() Array.ForEach(arr, i => { string si = $"{i}"; - sLocal += si; // EC75 - sLocal = sLocal + si; // EC75 - sLocal = si + sLocal; // EC75 + sLocal += si; // GCI75 + sLocal = sLocal + si; // GCI75 + sLocal = si + sLocal; // GCI75 sLocal = si + si; }); - Array.ForEach(arr, i => sLocal += $"{i}"); // EC75 - Array.ForEach(arr, i => sLocal = sLocal + $"{i}"); // EC75 - Array.ForEach(arr, i => sLocal = $"{i}" + sLocal); // EC75 + Array.ForEach(arr, i => sLocal += $"{i}"); // GCI75 + Array.ForEach(arr, i => sLocal = sLocal + $"{i}"); // GCI75 + Array.ForEach(arr, i => sLocal = $"{i}" + sLocal); // GCI75 Array.ForEach(arr, i => sLocal = $"{i}" + $"{i}"); var list = new List(); list.ForEach(i => { string si = $"{i}"; - sLocal += si; // EC75 - sLocal = sLocal + si; // EC75 - sLocal = si + sLocal; // EC75 + sLocal += si; // GCI75 + sLocal = sLocal + si; // GCI75 + sLocal = si + sLocal; // GCI75 sLocal = si + si; }); - list.ForEach(i => sLocal += $"{i}"); // EC75 + list.ForEach(i => sLocal += $"{i}"); // GCI75 list.ForEach(i => sLocal = sLocal + $"{i}"); // EC75 list.ForEach(i => sLocal = $"{i}" + sLocal); // EC75 list.ForEach(i => sLocal = $"{i}" + $"{i}"); diff --git a/RuleTests/EcoCode/EC81.SpecifyStructLayout.cs b/RuleTests/EcoCode/GCI81.SpecifyStructLayout.cs similarity index 70% rename from RuleTests/EcoCode/EC81.SpecifyStructLayout.cs rename to RuleTests/EcoCode/GCI81.SpecifyStructLayout.cs index a03818c..e0a4419 100644 --- a/RuleTests/EcoCode/EC81.SpecifyStructLayout.cs +++ b/RuleTests/EcoCode/GCI81.SpecifyStructLayout.cs @@ -8,14 +8,14 @@ internal static class SpecifyStructLayout public readonly record struct TestStruct2(int A); - public readonly record struct TestStruct3(int A, double B); // EC81, code fix: Add StructLayout attribute (Auto or Sequential) + public readonly record struct TestStruct3(int A, double B); // GCI81, code fix: Add StructLayout attribute (Auto or Sequential) [StructLayout(LayoutKind.Auto)] public readonly record struct TestStruct4(int A, double B); public readonly record struct TestStruct5(int A, string B); - public readonly record struct TestStruct6(int A, double B, int C); // EC81, code fix: Add StructLayout attribute (Auto or Sequential) + public readonly record struct TestStruct6(int A, double B, int C); // GCI81, code fix: Add StructLayout attribute (Auto or Sequential) - public readonly record struct TestStruct7(bool A, int B, char C, ulong E, DateTime F); // EC81, code fix: Add StructLayout attribute (Auto or Sequential) + public readonly record struct TestStruct7(bool A, int B, char C, ulong E, DateTime F); // GCI81, code fix: Add StructLayout attribute (Auto or Sequential) } diff --git a/RuleTests/EcoCode/EC82.VariableCanBeMadeConstant.cs b/RuleTests/EcoCode/GCI82.VariableCanBeMadeConstant.cs similarity index 69% rename from RuleTests/EcoCode/EC82.VariableCanBeMadeConstant.cs rename to RuleTests/EcoCode/GCI82.VariableCanBeMadeConstant.cs index 462fb1a..bdc248f 100644 --- a/RuleTests/EcoCode/EC82.VariableCanBeMadeConstant.cs +++ b/RuleTests/EcoCode/GCI82.VariableCanBeMadeConstant.cs @@ -4,7 +4,7 @@ internal static class VariableCanBeMadeConstant { public static void Run() { - int i0 = 0; // EC82, code fix: const int i0 = 0; + int i0 = 0; // GCI82, code fix: const int i0 = 0; Console.WriteLine(i0); int i1 = 0; @@ -24,20 +24,20 @@ public static void Run() Console.WriteLine(i5); Console.WriteLine(i6); - int i7 = 0, i8 = 0; // EC82, code fix: const int i7 = 0, i8 = 0; + int i7 = 0, i8 = 0; // GCI82, code fix: const int i7 = 0, i8 = 0; Console.WriteLine(i7); Console.WriteLine(i8); object o = "abc"; Console.WriteLine(o); - string s = "abc"; // EC82, code fix: const string s = "abc"; + string s = "abc"; // GCI82, code fix: const string s = "abc"; Console.WriteLine(s); - var v0 = 4; // EC82, code fix: const int item = 4; + var v0 = 4; // GCI82, code fix: const int item = 4; Console.WriteLine(v0); - var v1 = "abc"; // EC82, code fix: const string item = "abc"; + var v1 = "abc"; // GCI82, code fix: const string item = "abc"; Console.WriteLine(v1); } } diff --git a/RuleTests/EcoCode/GCI83.ReplaceEnumToStringWithNameOf.cs b/RuleTests/EcoCode/GCI83.ReplaceEnumToStringWithNameOf.cs new file mode 100644 index 0000000..54b4ade --- /dev/null +++ b/RuleTests/EcoCode/GCI83.ReplaceEnumToStringWithNameOf.cs @@ -0,0 +1,28 @@ +namespace RuleTests.EcoCode; + +internal static class ReplaceEnumToStringWithNameOf +{ + private enum MyEnum { A, B, C, D } + + public static void Run() + { + Console.WriteLine(nameof(MyEnum.A)); + Console.WriteLine(nameof(MyEnum.B)); + Console.WriteLine(nameof(MyEnum.C)); + Console.WriteLine(nameof(MyEnum.D)); + + Console.WriteLine(MyEnum.A.ToString()); // GCI83, code fix: nameof(MyEnum.A) + Console.WriteLine(MyEnum.B.ToString("")); // GCI83, code fix: nameof(MyEnum.B) + Console.WriteLine(MyEnum.C.ToString(string.Empty)); // GCI83, code fix: nameof(MyEnum.C) + Console.WriteLine(MyEnum.D.ToString(format: null)); // GCI83, code fix: nameof(MyEnum.D) + + Console.WriteLine(MyEnum.A.ToString("G")); // GCI83, code fix: nameof(MyEnum.A) + Console.WriteLine(MyEnum.B.ToString("F")); // GCI83, code fix: nameof(MyEnum.B) + Console.WriteLine(MyEnum.C.ToString("N")); + + Console.WriteLine($"{MyEnum.A}"); // GCI83, code fix: nameof(MyEnum.A) + Console.WriteLine($"{MyEnum.B:G}"); // GCI83, code fix: nameof(MyEnum.B) + Console.WriteLine($"{MyEnum.C:F}"); // GCI83, code fix: nameof(MyEnum.C) + Console.WriteLine($"{MyEnum.D:N}"); + } +} diff --git a/RuleTests/EcoCode/EC84.AvoidAsyncVoidMethods.cs b/RuleTests/EcoCode/GCI84.AvoidAsyncVoidMethods.cs similarity index 73% rename from RuleTests/EcoCode/EC84.AvoidAsyncVoidMethods.cs rename to RuleTests/EcoCode/GCI84.AvoidAsyncVoidMethods.cs index e999d5d..85621ed 100644 --- a/RuleTests/EcoCode/EC84.AvoidAsyncVoidMethods.cs +++ b/RuleTests/EcoCode/GCI84.AvoidAsyncVoidMethods.cs @@ -4,7 +4,7 @@ namespace RuleTests.EcoCode; internal static class AvoidAsyncVoidMethods { - public static async void Method1() => // EC84, code fix: public static async Task Method1() + public static async void Method1() => // GCI84, code fix: public static async Task Method1() await Task.Delay(1000).ConfigureAwait(false); public static async Task Method2() => @@ -16,7 +16,7 @@ public static async Task Method3() return 1; } - public static async void Method4() // EC84, code fix: public static async Task Method4() + public static async void Method4() // GCI84, code fix: public static async Task Method4() { using var httpClient = new HttpClient(); _ = await httpClient.GetAsync(new Uri("URL")).ConfigureAwait(false); diff --git a/RuleTests/EcoCode/EC85.MakeTypeSealed.cs b/RuleTests/EcoCode/GCI85.MakeTypeSealed.cs similarity index 77% rename from RuleTests/EcoCode/EC85.MakeTypeSealed.cs rename to RuleTests/EcoCode/GCI85.MakeTypeSealed.cs index d864c91..c6088d9 100644 --- a/RuleTests/EcoCode/EC85.MakeTypeSealed.cs +++ b/RuleTests/EcoCode/GCI85.MakeTypeSealed.cs @@ -1,59 +1,59 @@ namespace RuleTests.EcoCode; -// Because EC85 is a compiler warning, it can't appear live in the editor. +// Because GCI85 is a compiler warning, it can't appear live in the editor. // It can appear in the Error List after a compilation or after using 'Run Code Analysis', // but only if the option 'all' is set in the .csproj file. internal static class MakeTypeSealed { - public class TestA; // EC85: make type sealed - internal class TestB; // EC85: make type sealed + public class TestA; // GCI85: make type sealed + internal class TestB; // GCI85: make type sealed public static class Test0 { - public class Test01; // EC85: make type sealed - internal class Test02; // EC85: make type sealed - private class Test03; // EC85: make type sealed + public class Test01; // GCI85: make type sealed + internal class Test02; // GCI85: make type sealed + private class Test03; // GCI85: make type sealed } internal static class Test1 { - public class Test11; // EC85: make type sealed - internal class Test12; // EC85: make type sealed - private class Test13; // EC85: make type sealed + public class Test11; // GCI85: make type sealed + internal class Test12; // GCI85: make type sealed + private class Test13; // GCI85: make type sealed } public static class SealableClasses { - public class TestA; // EC85: make type sealed - internal class TestB; // EC85: make type sealed + public class TestA; // GCI85: make type sealed + internal class TestB; // GCI85: make type sealed public static class Test0 { - public class Test01; // EC85: make type sealed - internal class Test02; // EC85: make type sealed - private class Test03; // EC85: make type sealed + public class Test01; // GCI85: make type sealed + internal class Test02; // GCI85: make type sealed + private class Test03; // GCI85: make type sealed } internal static class Test1 { - public class Test11; // EC85: make type sealed - internal class Test12; // EC85: make type sealed - private class Test13; // EC85: make type sealed + public class Test11; // GCI85: make type sealed + internal class Test12; // GCI85: make type sealed + private class Test13; // GCI85: make type sealed } } public static class SealableRecords { - public record TestA; // EC85: make type sealed - internal record TestB; // EC85: make type sealed + public record TestA; // GCI85: make type sealed + internal record TestB; // GCI85: make type sealed public static class Test0 { - public record Test01; // EC85: make type sealed - internal record Test02; // EC85: make type sealed - private record Test03; // EC85: make type sealed + public record Test01; // GCI85: make type sealed + internal record Test02; // GCI85: make type sealed + private record Test03; // GCI85: make type sealed } internal static class Test1 { - public record Test11; // EC85: make type sealed - internal record Test12; // EC85: make type sealed - private record Test13; // EC85: make type sealed + public record Test11; // GCI85: make type sealed + internal record Test12; // GCI85: make type sealed + private record Test13; // GCI85: make type sealed } } @@ -130,48 +130,48 @@ private sealed class Test13; public static class SealableClassesWithInterface { public interface ITest { void Method(); } - public class TestA : ITest { public void Method() { } } // EC85: make type sealed - internal class TestB : ITest { public void Method() { } } // EC85: make type sealed + public class TestA : ITest { public void Method() { } } // GCI85: make type sealed + internal class TestB : ITest { public void Method() { } } // GCI85: make type sealed public static class Test0 { - public class Test01 : ITest { public void Method() { } } // EC85: make type sealed - internal class Test02 : ITest { public void Method() { } } // EC85: make type sealed - private class Test03 : ITest { public void Method() { } } // EC85: make type sealed + public class Test01 : ITest { public void Method() { } } // GCI85: make type sealed + internal class Test02 : ITest { public void Method() { } } // GCI85: make type sealed + private class Test03 : ITest { public void Method() { } } // GCI85: make type sealed } internal static class Test1 { - public class Test11 : ITest { public void Method() { } } // EC85: make type sealed - internal class Test12 : ITest { public void Method() { } } // EC85: make type sealed - private class Test13 : ITest { public void Method() { } } // EC85: make type sealed + public class Test11 : ITest { public void Method() { } } // GCI85: make type sealed + internal class Test12 : ITest { public void Method() { } } // GCI85: make type sealed + private class Test13 : ITest { public void Method() { } } // GCI85: make type sealed } } public static class SealableClassesWithOverridable { public class TestA1 { public virtual void Method() { } } - public class TestA2 { internal virtual void Method() { } } // EC85: make type sealed + public class TestA2 { internal virtual void Method() { } } // GCI85: make type sealed public class TestA3 { protected virtual void Method() { } } - public class TestA4 { protected internal virtual void Method() { } } // EC85: make type sealed - public class TestA5 { private protected virtual void Method() { } } // EC85: make type sealed + public class TestA4 { protected internal virtual void Method() { } } // GCI85: make type sealed + public class TestA5 { private protected virtual void Method() { } } // GCI85: make type sealed - internal class TestB1 { public virtual void Method() { } } // EC85: make type sealed - internal class TestB2 { internal virtual void Method() { } } // EC85: make type sealed - internal class TestB3 { protected virtual void Method() { } } // EC85: make type sealed - internal class TestB4 { protected internal virtual void Method() { } } // EC85: make type sealed - internal class TestB5 { private protected virtual void Method() { } } // EC85: make type sealed + internal class TestB1 { public virtual void Method() { } } // GCI85: make type sealed + internal class TestB2 { internal virtual void Method() { } } // GCI85: make type sealed + internal class TestB3 { protected virtual void Method() { } } // GCI85: make type sealed + internal class TestB4 { protected internal virtual void Method() { } } // GCI85: make type sealed + internal class TestB5 { private protected virtual void Method() { } } // GCI85: make type sealed public static class Test0 { public class TestA1 { public virtual void Method() { } } - public class TestA2 { internal virtual void Method() { } } // EC85: make type sealed + public class TestA2 { internal virtual void Method() { } } // GCI85: make type sealed public class TestA3 { protected virtual void Method() { } } - public class TestA4 { protected internal virtual void Method() { } } // EC85: make type sealed - public class TestA5 { private protected virtual void Method() { } } // EC85: make type sealed + public class TestA4 { protected internal virtual void Method() { } } // GCI85: make type sealed + public class TestA5 { private protected virtual void Method() { } } // GCI85: make type sealed - internal class TestB1 { public virtual void Method() { } } // EC85: make type sealed - internal class TestB2 { internal virtual void Method() { } } // EC85: make type sealed - internal class TestB3 { protected virtual void Method() { } } // EC85: make type sealed - internal class TestB4 { protected internal virtual void Method() { } } // EC85: make type sealed + internal class TestB1 { public virtual void Method() { } } // GCI85: make type sealed + internal class TestB2 { internal virtual void Method() { } } // GCI85: make type sealed + internal class TestB3 { protected virtual void Method() { } } // GCI85: make type sealed + internal class TestB4 { protected internal virtual void Method() { } } // GCI85: make type sealed internal class TestB5 { private protected virtual void Method() { } } // EC85: make type sealed private class TestC1 { public virtual void Method() { } } // EC85: make type sealed diff --git a/RuleTests/EcoCode/EC86.GCCollectShouldNotBeCalled.cs b/RuleTests/EcoCode/GCI86.GCCollectShouldNotBeCalled.cs similarity index 74% rename from RuleTests/EcoCode/EC86.GCCollectShouldNotBeCalled.cs rename to RuleTests/EcoCode/GCI86.GCCollectShouldNotBeCalled.cs index 1d79f26..a92b9e0 100644 --- a/RuleTests/EcoCode/EC86.GCCollectShouldNotBeCalled.cs +++ b/RuleTests/EcoCode/GCI86.GCCollectShouldNotBeCalled.cs @@ -6,24 +6,24 @@ public static void Run() { // GC.Collect(); - GC.Collect(); // EC86 + GC.Collect(); // GCI86 - GC.Collect(); // EC86 + GC.Collect(); // GCI86 GC.Collect(0); - GC.Collect(2); // EC86 + GC.Collect(2); // GCI86 GC.Collect(0, GCCollectionMode.Optimized); - GC.Collect(2, GCCollectionMode.Forced); // EC86 + GC.Collect(2, GCCollectionMode.Forced); // GCI86 GC.Collect(generation: 0, GCCollectionMode.Optimized); - GC.Collect(generation: 2, GCCollectionMode.Optimized); // EC86 + GC.Collect(generation: 2, GCCollectionMode.Optimized); // GCI86 GC.Collect(mode: GCCollectionMode.Optimized, generation: 0); - GC.Collect(mode: GCCollectionMode.Optimized, generation: 2); // EC86 + GC.Collect(mode: GCCollectionMode.Optimized, generation: 2); // GCI86 } } diff --git a/RuleTests/EcoCode/EC87.UseListIndexer.cs b/RuleTests/EcoCode/GCI87.UseListIndexer.cs similarity index 79% rename from RuleTests/EcoCode/EC87.UseListIndexer.cs rename to RuleTests/EcoCode/GCI87.UseListIndexer.cs index 401e127..3a7f096 100644 --- a/RuleTests/EcoCode/EC87.UseListIndexer.cs +++ b/RuleTests/EcoCode/GCI87.UseListIndexer.cs @@ -20,23 +20,23 @@ private sealed class MyCollection2 : List public static void Run() { - Console.WriteLine(Arr.First()); // EC87 + Console.WriteLine(Arr.First()); // GCI87 Console.WriteLine(Arr.First(x => x != 1)); - Console.WriteLine(Arr.Last()); // EC87 + Console.WriteLine(Arr.Last()); // GCI87 Console.WriteLine(Arr.Last(x => x != 1)); - Console.WriteLine(Arr.ElementAt(2)); // EC87 + Console.WriteLine(Arr.ElementAt(2)); // GCI87 - Console.WriteLine(List.First()); // EC87 + Console.WriteLine(List.First()); // GCI87 Console.WriteLine(List.First(x => x != 1)); - Console.WriteLine(List.Last()); // EC87 + Console.WriteLine(List.Last()); // GCI87 Console.WriteLine(List.Last(x => x != 1)); - Console.WriteLine(List.ElementAt(2)); // EC87 + Console.WriteLine(List.ElementAt(2)); // GCI87 - Console.WriteLine(Coll1.First()); // EC87 + Console.WriteLine(Coll1.First()); // GCI87 Console.WriteLine(Coll1.First(x => x != 1)); - Console.WriteLine(Coll1.Last()); // EC87 + Console.WriteLine(Coll1.Last()); // GCI87 Console.WriteLine(Coll1.Last(x => x != 1)); - Console.WriteLine(Coll1.ElementAt(2)); // EC87 + Console.WriteLine(Coll1.ElementAt(2)); // GCI87 Console.WriteLine(Coll2.First()); Console.WriteLine(Coll2.First(x => x != 1)); diff --git a/RuleTests/EcoCode/EC88.DisposeResourceAsynchronusly.cs b/RuleTests/EcoCode/GCI88.DisposeResourceAsynchronusly.cs similarity index 89% rename from RuleTests/EcoCode/EC88.DisposeResourceAsynchronusly.cs rename to RuleTests/EcoCode/GCI88.DisposeResourceAsynchronusly.cs index 0667c2f..e855407 100644 --- a/RuleTests/EcoCode/EC88.DisposeResourceAsynchronusly.cs +++ b/RuleTests/EcoCode/GCI88.DisposeResourceAsynchronusly.cs @@ -31,10 +31,10 @@ public static async Task RunAsync() Console.WriteLine(d12); // Warn on asyncable usings - using (var d21 = new AsyncDisposableClass()) // EC88 : Dispose resource asynchronously + using (var d21 = new AsyncDisposableClass()) // GCI88 : Dispose resource asynchronously Console.WriteLine(d21); - using var d22 = new AsyncDisposableClass(); // EC88 : Dispose resource asynchronously + using var d22 = new AsyncDisposableClass(); // GCI88 : Dispose resource asynchronously Console.WriteLine(d22); await Task.CompletedTask.ConfigureAwait(false); diff --git a/RuleTests/EcoCode/EC91.UseWhereBeforeOrderBy.cs b/RuleTests/EcoCode/GCI91.UseWhereBeforeOrderBy.cs similarity index 82% rename from RuleTests/EcoCode/EC91.UseWhereBeforeOrderBy.cs rename to RuleTests/EcoCode/GCI91.UseWhereBeforeOrderBy.cs index 0f08142..74dded3 100644 --- a/RuleTests/EcoCode/EC91.UseWhereBeforeOrderBy.cs +++ b/RuleTests/EcoCode/GCI91.UseWhereBeforeOrderBy.cs @@ -7,7 +7,7 @@ public static void Test1() var items = new List(); var query = items .OrderBy(x => x) - .Where(x => x > 10) // EC91 + .Where(x => x > 10) // GCI91 .Select(x => x); } @@ -16,7 +16,7 @@ public static void Test2() var items = new List(); var query = items .OrderByDescending(x => x) - .Where(x => x > 10) // EC91 + .Where(x => x > 10) // GCI91 .Select(x => x); } @@ -25,7 +25,7 @@ public static void Test3() var items = new List(); var query = from item in items orderby item - where item > 10 // EC91 + where item > 10 // GCI91 select item; } @@ -34,7 +34,7 @@ public static void Test4() var items = new List(); var query = from item in items orderby item descending - where item > 10 // EC91 + where item > 10 // GCI91 select item; } } diff --git a/RuleTests/EcoCode/EC92.UseLengthToTestEmptyStrings.cs b/RuleTests/EcoCode/GCI92.UseLengthToTestEmptyStrings.cs similarity index 86% rename from RuleTests/EcoCode/EC92.UseLengthToTestEmptyStrings.cs rename to RuleTests/EcoCode/GCI92.UseLengthToTestEmptyStrings.cs index 73e3826..b250853 100644 --- a/RuleTests/EcoCode/EC92.UseLengthToTestEmptyStrings.cs +++ b/RuleTests/EcoCode/GCI92.UseLengthToTestEmptyStrings.cs @@ -4,7 +4,7 @@ internal static class UseLengthToTestEmpyString { public static void Test(string s) { - if (s == "") // EC92 + if (s == "") // GCI92 { Console.WriteLine("Empty"); } diff --git a/RuleTests/EcoCode/EC93.ReturnTaskDirectly.cs b/RuleTests/EcoCode/GCI93.ReturnTaskDirectly.cs similarity index 94% rename from RuleTests/EcoCode/EC93.ReturnTaskDirectly.cs rename to RuleTests/EcoCode/GCI93.ReturnTaskDirectly.cs index a6a0e0d..0780efe 100644 --- a/RuleTests/EcoCode/EC93.ReturnTaskDirectly.cs +++ b/RuleTests/EcoCode/GCI93.ReturnTaskDirectly.cs @@ -24,18 +24,18 @@ public static async Task DontWarnWithMultipleStatements2Async() await Task.Delay(0).ConfigureAwait(false); } - public static async Task WarnOnSingleAwaitExpressionAsync() => // EC93 + public static async Task WarnOnSingleAwaitExpressionAsync() => // GCI93 // Comment await Task.Delay(0).ConfigureAwait(false); - public static async Task WarnOnSingleAwaitBody1Async() // EC93 + public static async Task WarnOnSingleAwaitBody1Async() // GCI93 { // Comment 0 await Task.Delay(0).ConfigureAwait(false); // Comment 1 // Comment 2 } - public static async Task WarnOnSingleAwaitBody2Async() // EC93 + public static async Task WarnOnSingleAwaitBody2Async() // GCI93 { // Comment 0 return await Task.FromResult(0).ConfigureAwait(false); // Comment 1 From 26ae57f916bed2109e3bb755beac3c0d3a58b7d7 Mon Sep 17 00:00:00 2001 From: Vincent Marmin <3215889+vincent314@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:20:53 +0100 Subject: [PATCH 2/2] feat: rename project from ecoCode to creedengo --- README.md | 6 +++--- .../GCI69.DontCallFunctionsInLoopConditions.cs | 2 +- .../GCI72.DontExecuteSqlCommandsInLoops.cs | 2 +- .../GCI75.DontConcatenateStringsInLoops.cs | 2 +- .../{EcoCode => Creedengo}/GCI81.SpecifyStructLayout.cs | 2 +- .../GCI82.VariableCanBeMadeConstant.cs | 2 +- .../GCI83.ReplaceEnumToStringWithNameOf.cs | 2 +- .../{EcoCode => Creedengo}/GCI84.AvoidAsyncVoidMethods.cs | 2 +- RuleTests/{EcoCode => Creedengo}/GCI85.MakeTypeSealed.cs | 2 +- .../GCI86.GCCollectShouldNotBeCalled.cs | 2 +- RuleTests/{EcoCode => Creedengo}/GCI87.UseListIndexer.cs | 2 +- .../GCI88.DisposeResourceAsynchronusly.cs | 2 +- .../{EcoCode => Creedengo}/GCI91.UseWhereBeforeOrderBy.cs | 2 +- .../GCI92.UseLengthToTestEmptyStrings.cs | 2 +- .../{EcoCode => Creedengo}/GCI93.ReturnTaskDirectly.cs | 2 +- ...t-project.csproj => creedengo-csharp-test-project.csproj | 6 +++--- ...rp-test-project.sln => creedengo-csharp-test-project.sln | 2 +- tool_send_to_sonar.sh | 4 ++-- 18 files changed, 23 insertions(+), 23 deletions(-) rename RuleTests/{EcoCode => Creedengo}/GCI69.DontCallFunctionsInLoopConditions.cs (96%) rename RuleTests/{EcoCode => Creedengo}/GCI72.DontExecuteSqlCommandsInLoops.cs (95%) rename RuleTests/{EcoCode => Creedengo}/GCI75.DontConcatenateStringsInLoops.cs (99%) rename RuleTests/{EcoCode => Creedengo}/GCI81.SpecifyStructLayout.cs (96%) rename RuleTests/{EcoCode => Creedengo}/GCI82.VariableCanBeMadeConstant.cs (96%) rename RuleTests/{EcoCode => Creedengo}/GCI83.ReplaceEnumToStringWithNameOf.cs (97%) rename RuleTests/{EcoCode => Creedengo}/GCI84.AvoidAsyncVoidMethods.cs (95%) rename RuleTests/{EcoCode => Creedengo}/GCI85.MakeTypeSealed.cs (99%) rename RuleTests/{EcoCode => Creedengo}/GCI86.GCCollectShouldNotBeCalled.cs (94%) rename RuleTests/{EcoCode => Creedengo}/GCI87.UseListIndexer.cs (98%) rename RuleTests/{EcoCode => Creedengo}/GCI88.DisposeResourceAsynchronusly.cs (97%) rename RuleTests/{EcoCode => Creedengo}/GCI91.UseWhereBeforeOrderBy.cs (96%) rename RuleTests/{EcoCode => Creedengo}/GCI92.UseLengthToTestEmptyStrings.cs (85%) rename RuleTests/{EcoCode => Creedengo}/GCI93.ReturnTaskDirectly.cs (97%) rename ecoCode-csharp-test-project.csproj => creedengo-csharp-test-project.csproj (73%) rename ecoCode-csharp-test-project.sln => creedengo-csharp-test-project.sln (89%) diff --git a/README.md b/README.md index 419f159..3e93024 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -A project that can be used to test the latest version of the [ecoCode-charp](https://github.com/green-code-initiative/ecoCode-charp) NuGet package. +A project that can be used to test the latest version of the [creedengo-charp](https://github.com/green-code-initiative/creedengo-charp) NuGet package. ### 1. Set up your local environment -- Install/update the .NET SDK on your machine, the minimum required version is specified in the ecoCode-charp's [global.json](https://github.com/green-code-initiative/ecoCode-csharp/blob/main/global.json) file. -- Clone this repository locally on your machine. Since this project is used to test the very latest ecoCode-csharp rules, including the beta versions, it is recommended to check it out often. +- Install/update the .NET SDK on your machine, the minimum required version is specified in the creedengo-charp's [global.json](https://github.com/green-code-initiative/creedengo-csharp/blob/main/global.json) file. +- Clone this repository locally on your machine. Since this project is used to test the very latest creedengo-csharp rules, including the beta versions, it is recommended to check it out often. - Optional : install the IDE of your choice for C# (e.g. Visual Studio, Visual Studio Code, Rider, etc.) if you want to test with a GUI. ### 2. Test the rules through the CLI diff --git a/RuleTests/EcoCode/GCI69.DontCallFunctionsInLoopConditions.cs b/RuleTests/Creedengo/GCI69.DontCallFunctionsInLoopConditions.cs similarity index 96% rename from RuleTests/EcoCode/GCI69.DontCallFunctionsInLoopConditions.cs rename to RuleTests/Creedengo/GCI69.DontCallFunctionsInLoopConditions.cs index 12228ab..30be349 100644 --- a/RuleTests/EcoCode/GCI69.DontCallFunctionsInLoopConditions.cs +++ b/RuleTests/Creedengo/GCI69.DontCallFunctionsInLoopConditions.cs @@ -1,6 +1,6 @@ using System.IO; -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class DontCallFunctionsInLoopConditions { diff --git a/RuleTests/EcoCode/GCI72.DontExecuteSqlCommandsInLoops.cs b/RuleTests/Creedengo/GCI72.DontExecuteSqlCommandsInLoops.cs similarity index 95% rename from RuleTests/EcoCode/GCI72.DontExecuteSqlCommandsInLoops.cs rename to RuleTests/Creedengo/GCI72.DontExecuteSqlCommandsInLoops.cs index cae2c49..162e9d8 100644 --- a/RuleTests/EcoCode/GCI72.DontExecuteSqlCommandsInLoops.cs +++ b/RuleTests/Creedengo/GCI72.DontExecuteSqlCommandsInLoops.cs @@ -1,6 +1,6 @@ using System.Data; -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class DontExecuteSqlCommandsInLoops { diff --git a/RuleTests/EcoCode/GCI75.DontConcatenateStringsInLoops.cs b/RuleTests/Creedengo/GCI75.DontConcatenateStringsInLoops.cs similarity index 99% rename from RuleTests/EcoCode/GCI75.DontConcatenateStringsInLoops.cs rename to RuleTests/Creedengo/GCI75.DontConcatenateStringsInLoops.cs index 9a30367..5dfe2e0 100644 --- a/RuleTests/EcoCode/GCI75.DontConcatenateStringsInLoops.cs +++ b/RuleTests/Creedengo/GCI75.DontConcatenateStringsInLoops.cs @@ -1,6 +1,6 @@ using System.Collections.Immutable; -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class DontConcatenateStringsInLoops { diff --git a/RuleTests/EcoCode/GCI81.SpecifyStructLayout.cs b/RuleTests/Creedengo/GCI81.SpecifyStructLayout.cs similarity index 96% rename from RuleTests/EcoCode/GCI81.SpecifyStructLayout.cs rename to RuleTests/Creedengo/GCI81.SpecifyStructLayout.cs index e0a4419..9e874f6 100644 --- a/RuleTests/EcoCode/GCI81.SpecifyStructLayout.cs +++ b/RuleTests/Creedengo/GCI81.SpecifyStructLayout.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class SpecifyStructLayout { diff --git a/RuleTests/EcoCode/GCI82.VariableCanBeMadeConstant.cs b/RuleTests/Creedengo/GCI82.VariableCanBeMadeConstant.cs similarity index 96% rename from RuleTests/EcoCode/GCI82.VariableCanBeMadeConstant.cs rename to RuleTests/Creedengo/GCI82.VariableCanBeMadeConstant.cs index bdc248f..bbaa2ab 100644 --- a/RuleTests/EcoCode/GCI82.VariableCanBeMadeConstant.cs +++ b/RuleTests/Creedengo/GCI82.VariableCanBeMadeConstant.cs @@ -1,4 +1,4 @@ -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class VariableCanBeMadeConstant { diff --git a/RuleTests/EcoCode/GCI83.ReplaceEnumToStringWithNameOf.cs b/RuleTests/Creedengo/GCI83.ReplaceEnumToStringWithNameOf.cs similarity index 97% rename from RuleTests/EcoCode/GCI83.ReplaceEnumToStringWithNameOf.cs rename to RuleTests/Creedengo/GCI83.ReplaceEnumToStringWithNameOf.cs index 54b4ade..365c22b 100644 --- a/RuleTests/EcoCode/GCI83.ReplaceEnumToStringWithNameOf.cs +++ b/RuleTests/Creedengo/GCI83.ReplaceEnumToStringWithNameOf.cs @@ -1,4 +1,4 @@ -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class ReplaceEnumToStringWithNameOf { diff --git a/RuleTests/EcoCode/GCI84.AvoidAsyncVoidMethods.cs b/RuleTests/Creedengo/GCI84.AvoidAsyncVoidMethods.cs similarity index 95% rename from RuleTests/EcoCode/GCI84.AvoidAsyncVoidMethods.cs rename to RuleTests/Creedengo/GCI84.AvoidAsyncVoidMethods.cs index 85621ed..2439463 100644 --- a/RuleTests/EcoCode/GCI84.AvoidAsyncVoidMethods.cs +++ b/RuleTests/Creedengo/GCI84.AvoidAsyncVoidMethods.cs @@ -1,6 +1,6 @@ using System.Net.Http; -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class AvoidAsyncVoidMethods { diff --git a/RuleTests/EcoCode/GCI85.MakeTypeSealed.cs b/RuleTests/Creedengo/GCI85.MakeTypeSealed.cs similarity index 99% rename from RuleTests/EcoCode/GCI85.MakeTypeSealed.cs rename to RuleTests/Creedengo/GCI85.MakeTypeSealed.cs index c6088d9..64df3ce 100644 --- a/RuleTests/EcoCode/GCI85.MakeTypeSealed.cs +++ b/RuleTests/Creedengo/GCI85.MakeTypeSealed.cs @@ -1,4 +1,4 @@ -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; // Because GCI85 is a compiler warning, it can't appear live in the editor. // It can appear in the Error List after a compilation or after using 'Run Code Analysis', diff --git a/RuleTests/EcoCode/GCI86.GCCollectShouldNotBeCalled.cs b/RuleTests/Creedengo/GCI86.GCCollectShouldNotBeCalled.cs similarity index 94% rename from RuleTests/EcoCode/GCI86.GCCollectShouldNotBeCalled.cs rename to RuleTests/Creedengo/GCI86.GCCollectShouldNotBeCalled.cs index a92b9e0..05c2c20 100644 --- a/RuleTests/EcoCode/GCI86.GCCollectShouldNotBeCalled.cs +++ b/RuleTests/Creedengo/GCI86.GCCollectShouldNotBeCalled.cs @@ -1,4 +1,4 @@ -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class GCCollectShouldNotBeCalled { diff --git a/RuleTests/EcoCode/GCI87.UseListIndexer.cs b/RuleTests/Creedengo/GCI87.UseListIndexer.cs similarity index 98% rename from RuleTests/EcoCode/GCI87.UseListIndexer.cs rename to RuleTests/Creedengo/GCI87.UseListIndexer.cs index 3a7f096..cde7679 100644 --- a/RuleTests/EcoCode/GCI87.UseListIndexer.cs +++ b/RuleTests/Creedengo/GCI87.UseListIndexer.cs @@ -1,4 +1,4 @@ -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class UseListIndexer { diff --git a/RuleTests/EcoCode/GCI88.DisposeResourceAsynchronusly.cs b/RuleTests/Creedengo/GCI88.DisposeResourceAsynchronusly.cs similarity index 97% rename from RuleTests/EcoCode/GCI88.DisposeResourceAsynchronusly.cs rename to RuleTests/Creedengo/GCI88.DisposeResourceAsynchronusly.cs index e855407..1e6b70c 100644 --- a/RuleTests/EcoCode/GCI88.DisposeResourceAsynchronusly.cs +++ b/RuleTests/Creedengo/GCI88.DisposeResourceAsynchronusly.cs @@ -1,4 +1,4 @@ -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; [SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope", Justification = "Valid warning but we don't need it here")] internal static class DisposeResourceAsynchronusly diff --git a/RuleTests/EcoCode/GCI91.UseWhereBeforeOrderBy.cs b/RuleTests/Creedengo/GCI91.UseWhereBeforeOrderBy.cs similarity index 96% rename from RuleTests/EcoCode/GCI91.UseWhereBeforeOrderBy.cs rename to RuleTests/Creedengo/GCI91.UseWhereBeforeOrderBy.cs index 74dded3..b0edda8 100644 --- a/RuleTests/EcoCode/GCI91.UseWhereBeforeOrderBy.cs +++ b/RuleTests/Creedengo/GCI91.UseWhereBeforeOrderBy.cs @@ -1,4 +1,4 @@ -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class UseWhereBeforeOrderBy { diff --git a/RuleTests/EcoCode/GCI92.UseLengthToTestEmptyStrings.cs b/RuleTests/Creedengo/GCI92.UseLengthToTestEmptyStrings.cs similarity index 85% rename from RuleTests/EcoCode/GCI92.UseLengthToTestEmptyStrings.cs rename to RuleTests/Creedengo/GCI92.UseLengthToTestEmptyStrings.cs index b250853..b44e938 100644 --- a/RuleTests/EcoCode/GCI92.UseLengthToTestEmptyStrings.cs +++ b/RuleTests/Creedengo/GCI92.UseLengthToTestEmptyStrings.cs @@ -1,4 +1,4 @@ -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class UseLengthToTestEmpyString { diff --git a/RuleTests/EcoCode/GCI93.ReturnTaskDirectly.cs b/RuleTests/Creedengo/GCI93.ReturnTaskDirectly.cs similarity index 97% rename from RuleTests/EcoCode/GCI93.ReturnTaskDirectly.cs rename to RuleTests/Creedengo/GCI93.ReturnTaskDirectly.cs index 0780efe..aaf418d 100644 --- a/RuleTests/EcoCode/GCI93.ReturnTaskDirectly.cs +++ b/RuleTests/Creedengo/GCI93.ReturnTaskDirectly.cs @@ -1,4 +1,4 @@ -namespace RuleTests.EcoCode; +namespace RuleTests.Creedengo; internal static class ReturnTaskDirectly { diff --git a/ecoCode-csharp-test-project.csproj b/creedengo-csharp-test-project.csproj similarity index 73% rename from ecoCode-csharp-test-project.csproj rename to creedengo-csharp-test-project.csproj index 34ed2ba..84fbfb7 100644 --- a/ecoCode-csharp-test-project.csproj +++ b/creedengo-csharp-test-project.csproj @@ -3,8 +3,8 @@ Green Code Initiative Green Code Initiative - A project that contains code with warnings that should be raised by the EcoCode analyzers. - Copyright EcoCode © 2024 + A project that contains code with warnings that should be raised by the Creedengo analyzers. + Copyright Creedengo © 2024 net8.0 latest @@ -15,7 +15,7 @@ - + diff --git a/ecoCode-csharp-test-project.sln b/creedengo-csharp-test-project.sln similarity index 89% rename from ecoCode-csharp-test-project.sln rename to creedengo-csharp-test-project.sln index 71d3e92..c62b5aa 100644 --- a/ecoCode-csharp-test-project.sln +++ b/creedengo-csharp-test-project.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.9.34714.143 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ecoCode-csharp-test-project", "ecoCode-csharp-test-project.csproj", "{6AAA1AD9-DC43-4F33-898A-663C42B06DCA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "creedengo-csharp-test-project", "creedengo-csharp-test-project.csproj", "{6AAA1AD9-DC43-4F33-898A-663C42B06DCA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/tool_send_to_sonar.sh b/tool_send_to_sonar.sh index 7ef7066..e56f1c4 100755 --- a/tool_send_to_sonar.sh +++ b/tool_send_to_sonar.sh @@ -6,9 +6,9 @@ then exit 1 fi -PROJECT_KEY=ecoCode-csharp-test-project +PROJECT_KEY=creedengo-csharp-test-project SONAR_TOKEN=$1 dotnet sonarscanner begin /k:"$PROJECT_KEY" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="$SONAR_TOKEN" dotnet build -dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN" \ No newline at end of file +dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN"