-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rename rule keys from ECXXX to GCIXXX
- Loading branch information
1 parent
b0855eb
commit c30f95a
Showing
15 changed files
with
149 additions
and
149 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.