@@ -8,65 +8,70 @@ namespace Microsoft.AspNetCore.Components.Analyzers;
88[ System . Diagnostics . CodeAnalysis . SuppressMessage ( "MicrosoftCodeAnalysisReleaseTracking" , "RS2008:Enable analyzer release tracking" ) ]
99internal static class DiagnosticDescriptors
1010{
11- public static readonly DiagnosticDescriptor ComponentParameterSettersShouldBePublic = new DiagnosticDescriptor (
11+ private const string Encapsulation = "Encapsulation" ;
12+ private const string Usage = "Usage" ;
13+
14+ private static LocalizableResourceString CreateLocalizableResourceString ( string resource ) => new ( resource , Resources . ResourceManager , typeof ( Resources ) ) ;
15+
16+ public static readonly DiagnosticDescriptor ComponentParameterSettersShouldBePublic = new (
1217 "BL0001" ,
13- new LocalizableResourceString ( nameof ( Resources . ComponentParameterSettersShouldBePublic_Title ) , Resources . ResourceManager , typeof ( Resources ) ) ,
14- new LocalizableResourceString ( nameof ( Resources . ComponentParameterSettersShouldBePublic_Format ) , Resources . ResourceManager , typeof ( Resources ) ) ,
15- " Encapsulation" ,
18+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterSettersShouldBePublic_Title ) ) ,
19+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterSettersShouldBePublic_Format ) ) ,
20+ Encapsulation ,
1621 DiagnosticSeverity . Error ,
1722 isEnabledByDefault : true ,
18- description : new LocalizableResourceString ( nameof ( Resources . ComponentParameterSettersShouldBePublic_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
23+ description : CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterSettersShouldBePublic_Description ) ) ) ;
1924
20- public static readonly DiagnosticDescriptor ComponentParameterCaptureUnmatchedValuesMustBeUnique = new DiagnosticDescriptor (
25+ public static readonly DiagnosticDescriptor ComponentParameterCaptureUnmatchedValuesMustBeUnique = new (
2126 "BL0002" ,
22- new LocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesMustBeUnique_Title ) , Resources . ResourceManager , typeof ( Resources ) ) ,
23- new LocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesMustBeUnique_Format ) , Resources . ResourceManager , typeof ( Resources ) ) ,
24- " Usage" ,
27+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesMustBeUnique_Title ) ) ,
28+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesMustBeUnique_Format ) ) ,
29+ Usage ,
2530 DiagnosticSeverity . Warning ,
2631 isEnabledByDefault : true ,
27- description : new LocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesMustBeUnique_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
32+ description : CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesMustBeUnique_Description ) ) ) ;
2833
29- public static readonly DiagnosticDescriptor ComponentParameterCaptureUnmatchedValuesHasWrongType = new DiagnosticDescriptor (
34+ public static readonly DiagnosticDescriptor ComponentParameterCaptureUnmatchedValuesHasWrongType = new (
3035 "BL0003" ,
31- new LocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesHasWrongType_Title ) , Resources . ResourceManager , typeof ( Resources ) ) ,
32- new LocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesHasWrongType_Format ) , Resources . ResourceManager , typeof ( Resources ) ) ,
33- " Usage" ,
36+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesHasWrongType_Title ) ) ,
37+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesHasWrongType_Format ) ) ,
38+ Usage ,
3439 DiagnosticSeverity . Warning ,
3540 isEnabledByDefault : true ,
36- description : new LocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesHasWrongType_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
41+ description : CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesHasWrongType_Description ) ) ) ;
3742
38- public static readonly DiagnosticDescriptor ComponentParametersShouldBePublic = new DiagnosticDescriptor (
43+ public static readonly DiagnosticDescriptor ComponentParametersShouldBePublic = new (
3944 "BL0004" ,
40- new LocalizableResourceString ( nameof ( Resources . ComponentParameterShouldBePublic_Title ) , Resources . ResourceManager , typeof ( Resources ) ) ,
41- new LocalizableResourceString ( nameof ( Resources . ComponentParameterShouldBePublic_Format ) , Resources . ResourceManager , typeof ( Resources ) ) ,
42- " Encapsulation" ,
45+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterShouldBePublic_Title ) ) ,
46+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterShouldBePublic_Format ) ) ,
47+ Encapsulation ,
4348 DiagnosticSeverity . Error ,
4449 isEnabledByDefault : true ,
45- description : new LocalizableResourceString ( nameof ( Resources . ComponentParametersShouldBePublic_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
50+ description : CreateLocalizableResourceString ( nameof ( Resources . ComponentParametersShouldBePublic_Description ) ) ) ;
4651
47- public static readonly DiagnosticDescriptor ComponentParametersShouldNotBeSetOutsideOfTheirDeclaredComponent = new DiagnosticDescriptor (
52+ public static readonly DiagnosticDescriptor ComponentParametersShouldNotBeSetOutsideOfTheirDeclaredComponent = new (
4853 "BL0005" ,
49- new LocalizableResourceString ( nameof ( Resources . ComponentParameterShouldNotBeSetOutsideOfTheirDeclaredComponent_Title ) , Resources . ResourceManager , typeof ( Resources ) ) ,
50- new LocalizableResourceString ( nameof ( Resources . ComponentParameterShouldNotBeSetOutsideOfTheirDeclaredComponent_Format ) , Resources . ResourceManager , typeof ( Resources ) ) ,
51- " Usage" ,
54+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterShouldNotBeSetOutsideOfTheirDeclaredComponent_Title ) ) ,
55+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterShouldNotBeSetOutsideOfTheirDeclaredComponent_Format ) ) ,
56+ Usage ,
5257 DiagnosticSeverity . Warning ,
5358 isEnabledByDefault : true ,
54- description : new LocalizableResourceString ( nameof ( Resources . ComponentParameterShouldNotBeSetOutsideOfTheirDeclaredComponent_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
59+ description : CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterShouldNotBeSetOutsideOfTheirDeclaredComponent_Description ) ) ) ;
5560
56- public static readonly DiagnosticDescriptor DoNotUseRenderTreeTypes = new DiagnosticDescriptor (
61+ public static readonly DiagnosticDescriptor DoNotUseRenderTreeTypes = new (
5762 "BL0006" ,
58- new LocalizableResourceString ( nameof ( Resources . DoNotUseRenderTreeTypes_Title ) , Resources . ResourceManager , typeof ( Resources ) ) ,
59- new LocalizableResourceString ( nameof ( Resources . DoNotUseRenderTreeTypes_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ,
60- " Usage" ,
63+ CreateLocalizableResourceString ( nameof ( Resources . DoNotUseRenderTreeTypes_Title ) ) ,
64+ CreateLocalizableResourceString ( nameof ( Resources . DoNotUseRenderTreeTypes_Description ) ) ,
65+ Usage ,
6166 DiagnosticSeverity . Warning ,
6267 isEnabledByDefault : true ,
63- description : new LocalizableResourceString ( nameof ( Resources . DoNotUseRenderTreeTypes_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
68+ description : CreateLocalizableResourceString ( nameof ( Resources . DoNotUseRenderTreeTypes_Description ) ) ) ;
6469
6570 public static readonly DiagnosticDescriptor ComponentParametersShouldBeAutoProperties = new (
6671 "BL0007" ,
67- new LocalizableResourceString ( nameof ( Resources . ComponentParametersShouldBeAutoProperties_Title ) , Resources . ResourceManager , typeof ( Resources ) ) ,
68- new LocalizableResourceString ( nameof ( Resources . ComponentParametersShouldBeAutoProperties_Message ) , Resources . ResourceManager , typeof ( Resources ) ) ,
69- " Usage" ,
72+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParametersShouldBeAutoProperties_Title ) ) ,
73+ CreateLocalizableResourceString ( nameof ( Resources . ComponentParametersShouldBeAutoProperties_Message ) ) ,
74+ Usage ,
7075 DiagnosticSeverity . Warning ,
7176 isEnabledByDefault : true ) ;
7277}
0 commit comments