Refactored the identifiers

This commit is contained in:
tsommer committed 2025-02-23 17:08:25 +01:00
1 parent a33347ddb7
commit 12e876525a
4 files changed
+10 -3

No files matched your search

@@ -0,0 +1,7 @@
namespace SourceCodeRules;
public static class Identifier
{
public const string PROVIDER_ACCESS_ANALYZER = $"{Tools.ID_PREFIX}0001";
public const string CONST_STATIC_ANALYZER = $"{Tools.ID_PREFIX}0002";
}
@@ -13,7 +13,7 @@ namespace SourceCodeRules.NamingAnalyzers;
#pragma warning restore RS1038
public sealed class ConstStaticAnalyzer : DiagnosticAnalyzer
{
private const string DIAGNOSTIC_ID = $"{Tools.ID_PREFIX}0002";
private const string DIAGNOSTIC_ID = Identifier.CONST_STATIC_ANALYZER;
private static readonly string TITLE = "Constant and static fields must be in UPPER_CASE";
@@ -16,7 +16,7 @@ namespace SourceCodeRules.NamingCodeFixes;
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(ConstStaticCodeFixProvider)), Shared]
public sealed class ConstStaticCodeFixProvider : CodeFixProvider
{
public override ImmutableArray<string> FixableDiagnosticIds => [$"{Tools.ID_PREFIX}0002"];
public override ImmutableArray<string> FixableDiagnosticIds => [Identifier.CONST_STATIC_ANALYZER];
public override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;
@@ -13,7 +13,7 @@ namespace SourceCodeRules.UsageAnalyzers;
#pragma warning restore RS1038
public sealed class ProviderAccessAnalyzer : DiagnosticAnalyzer
{
private const string DIAGNOSTIC_ID = $"{Tools.ID_PREFIX}0001";
private const string DIAGNOSTIC_ID = Identifier.PROVIDER_ACCESS_ANALYZER;
private static readonly string TITLE = "Direct access to `Providers` is not allowed";