@@ -8,65 +8,70 @@ namespace Microsoft.AspNetCore.Components.Analyzers;
8
8
[ System . Diagnostics . CodeAnalysis . SuppressMessage ( "MicrosoftCodeAnalysisReleaseTracking" , "RS2008:Enable analyzer release tracking" ) ]
9
9
internal static class DiagnosticDescriptors
10
10
{
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 (
12
17
"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 ,
16
21
DiagnosticSeverity . Error ,
17
22
isEnabledByDefault : true ,
18
- description : new LocalizableResourceString ( nameof ( Resources . ComponentParameterSettersShouldBePublic_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
23
+ description : CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterSettersShouldBePublic_Description ) ) ) ;
19
24
20
- public static readonly DiagnosticDescriptor ComponentParameterCaptureUnmatchedValuesMustBeUnique = new DiagnosticDescriptor (
25
+ public static readonly DiagnosticDescriptor ComponentParameterCaptureUnmatchedValuesMustBeUnique = new (
21
26
"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 ,
25
30
DiagnosticSeverity . Warning ,
26
31
isEnabledByDefault : true ,
27
- description : new LocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesMustBeUnique_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
32
+ description : CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesMustBeUnique_Description ) ) ) ;
28
33
29
- public static readonly DiagnosticDescriptor ComponentParameterCaptureUnmatchedValuesHasWrongType = new DiagnosticDescriptor (
34
+ public static readonly DiagnosticDescriptor ComponentParameterCaptureUnmatchedValuesHasWrongType = new (
30
35
"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 ,
34
39
DiagnosticSeverity . Warning ,
35
40
isEnabledByDefault : true ,
36
- description : new LocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesHasWrongType_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
41
+ description : CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterCaptureUnmatchedValuesHasWrongType_Description ) ) ) ;
37
42
38
- public static readonly DiagnosticDescriptor ComponentParametersShouldBePublic = new DiagnosticDescriptor (
43
+ public static readonly DiagnosticDescriptor ComponentParametersShouldBePublic = new (
39
44
"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 ,
43
48
DiagnosticSeverity . Error ,
44
49
isEnabledByDefault : true ,
45
- description : new LocalizableResourceString ( nameof ( Resources . ComponentParametersShouldBePublic_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
50
+ description : CreateLocalizableResourceString ( nameof ( Resources . ComponentParametersShouldBePublic_Description ) ) ) ;
46
51
47
- public static readonly DiagnosticDescriptor ComponentParametersShouldNotBeSetOutsideOfTheirDeclaredComponent = new DiagnosticDescriptor (
52
+ public static readonly DiagnosticDescriptor ComponentParametersShouldNotBeSetOutsideOfTheirDeclaredComponent = new (
48
53
"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 ,
52
57
DiagnosticSeverity . Warning ,
53
58
isEnabledByDefault : true ,
54
- description : new LocalizableResourceString ( nameof ( Resources . ComponentParameterShouldNotBeSetOutsideOfTheirDeclaredComponent_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
59
+ description : CreateLocalizableResourceString ( nameof ( Resources . ComponentParameterShouldNotBeSetOutsideOfTheirDeclaredComponent_Description ) ) ) ;
55
60
56
- public static readonly DiagnosticDescriptor DoNotUseRenderTreeTypes = new DiagnosticDescriptor (
61
+ public static readonly DiagnosticDescriptor DoNotUseRenderTreeTypes = new (
57
62
"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 ,
61
66
DiagnosticSeverity . Warning ,
62
67
isEnabledByDefault : true ,
63
- description : new LocalizableResourceString ( nameof ( Resources . DoNotUseRenderTreeTypes_Description ) , Resources . ResourceManager , typeof ( Resources ) ) ) ;
68
+ description : CreateLocalizableResourceString ( nameof ( Resources . DoNotUseRenderTreeTypes_Description ) ) ) ;
64
69
65
70
public static readonly DiagnosticDescriptor ComponentParametersShouldBeAutoProperties = new (
66
71
"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 ,
70
75
DiagnosticSeverity . Warning ,
71
76
isEnabledByDefault : true ) ;
72
77
}
0 commit comments