Skip to content

Commit ccee420

Browse files
committed
Move string literals to resources
1 parent c737e92 commit ccee420

7 files changed

Lines changed: 201 additions & 21 deletions

StyleCop.Analyzers/StyleCop.Analyzers/OrderingRules/OrderingResources.Designer.cs

Lines changed: 136 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

StyleCop.Analyzers/StyleCop.Analyzers/OrderingRules/OrderingResources.resx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,42 @@
120120
<data name="ElementOrderCodeFix" xml:space="preserve">
121121
<value>Fix element order</value>
122122
</data>
123+
<data name="SA1201Description" xml:space="preserve">
124+
<value>An element within a C# code file is out of order in relation to the other elements in the code.</value>
125+
</data>
126+
<data name="SA1201MessageFormat" xml:space="preserve">
127+
<value>A {0} should not follow a {1}</value>
128+
</data>
129+
<data name="SA1201Title" xml:space="preserve">
130+
<value>Elements must appear in the correct order</value>
131+
</data>
132+
<data name="SA1202Description" xml:space="preserve">
133+
<value>An element within a C# code file is out of order in relation to other elements in the code.</value>
134+
</data>
135+
<data name="SA1202MessageFormat" xml:space="preserve">
136+
<value>'{0}' members must come before '{1}' members</value>
137+
</data>
138+
<data name="SA1202Title" xml:space="preserve">
139+
<value>Elements must be ordered by access</value>
140+
</data>
141+
<data name="SA1203Description" xml:space="preserve">
142+
<value>A constant field is placed beneath a non-constant field.</value>
143+
</data>
144+
<data name="SA1203MessageFormat" xml:space="preserve">
145+
<value>Constant fields must appear before non-constant fields</value>
146+
</data>
147+
<data name="SA1203Title" xml:space="preserve">
148+
<value>Constants must appear before fields</value>
149+
</data>
150+
<data name="SA1204Description" xml:space="preserve">
151+
<value>A static element is positioned beneath an instance element.</value>
152+
</data>
153+
<data name="SA1204MessageFormat" xml:space="preserve">
154+
<value>Static members must appear before non-static members</value>
155+
</data>
156+
<data name="SA1204Title" xml:space="preserve">
157+
<value>Static elements must appear before instance elements</value>
158+
</data>
123159
<data name="SA1205CodeFix" xml:space="preserve">
124160
<value>Add access modifier</value>
125161
</data>
@@ -129,6 +165,15 @@
129165
<data name="SA1213CodeFix" xml:space="preserve">
130166
<value>Fix accessor order</value>
131167
</data>
168+
<data name="SA1214Description" xml:space="preserve">
169+
<value>A readonly field is positioned beneath a non-readonly field.</value>
170+
</data>
171+
<data name="SA1214MessageFormat" xml:space="preserve">
172+
<value>Readonly fields must appear before non-readonly fields</value>
173+
</data>
174+
<data name="SA1214Title" xml:space="preserve">
175+
<value>Readonly fields must appear before non-readonly fields</value>
176+
</data>
132177
<data name="UsingCodeFix" xml:space="preserve">
133178
<value>Reorder using statements</value>
134179
</data>

StyleCop.Analyzers/StyleCop.Analyzers/OrderingRules/SA1201ElementsMustAppearInTheCorrectOrder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ internal class SA1201ElementsMustAppearInTheCorrectOrder : DiagnosticAnalyzer
111111
/// The ID for diagnostics produced by the <see cref="SA1201ElementsMustAppearInTheCorrectOrder"/> analyzer.
112112
/// </summary>
113113
public const string DiagnosticId = "SA1201";
114-
private const string Title = "Elements must appear in the correct order";
115-
private const string MessageFormat = "A {0} should not follow a {1}.";
116-
private const string Description = "An element within a C# code file is out of order in relation to the other elements in the code.";
117-
private const string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1201.md";
114+
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(OrderingResources.SA1201Title), OrderingResources.ResourceManager, typeof(OrderingResources));
115+
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(OrderingResources.SA1201MessageFormat), OrderingResources.ResourceManager, typeof(OrderingResources));
116+
private static readonly LocalizableString Description = new LocalizableResourceString(nameof(OrderingResources.SA1201Description), OrderingResources.ResourceManager, typeof(OrderingResources));
117+
private static readonly string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1201.md";
118118

119119
private static readonly DiagnosticDescriptor Descriptor =
120120
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.OrderingRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

StyleCop.Analyzers/StyleCop.Analyzers/OrderingRules/SA1202ElementsMustBeOrderedByAccess.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ internal class SA1202ElementsMustBeOrderedByAccess : DiagnosticAnalyzer
4242
/// The ID for diagnostics produced by the <see cref="SA1202ElementsMustBeOrderedByAccess"/> analyzer.
4343
/// </summary>
4444
public const string DiagnosticId = "SA1202";
45-
private const string Title = "Elements must be ordered by access";
46-
private const string MessageFormat = "'{0}' members must come before '{1}' members";
47-
private const string Description = "An element within a C# code file is out of order in relation to other elements in the code.";
48-
private const string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1202.md";
45+
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(OrderingResources.SA1202Title), OrderingResources.ResourceManager, typeof(OrderingResources));
46+
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(OrderingResources.SA1202MessageFormat), OrderingResources.ResourceManager, typeof(OrderingResources));
47+
private static readonly LocalizableString Description = new LocalizableResourceString(nameof(OrderingResources.SA1202Description), OrderingResources.ResourceManager, typeof(OrderingResources));
48+
private static readonly string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1202.md";
4949

5050
private static readonly DiagnosticDescriptor Descriptor =
5151
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.OrderingRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

StyleCop.Analyzers/StyleCop.Analyzers/OrderingRules/SA1203ConstantsMustAppearBeforeFields.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ internal class SA1203ConstantsMustAppearBeforeFields : DiagnosticAnalyzer
2727
/// The ID for diagnostics produced by the <see cref="SA1203ConstantsMustAppearBeforeFields"/> analyzer.
2828
/// </summary>
2929
public const string DiagnosticId = "SA1203";
30-
private const string Title = "Constants must appear before fields";
31-
private const string MessageFormat = "Constant fields must appear before non-constant fields";
32-
private const string Description = "A constant field is placed beneath a non-constant field.";
33-
private const string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1203.md";
30+
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(OrderingResources.SA1203Title), OrderingResources.ResourceManager, typeof(OrderingResources));
31+
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(OrderingResources.SA1203MessageFormat), OrderingResources.ResourceManager, typeof(OrderingResources));
32+
private static readonly LocalizableString Description = new LocalizableResourceString(nameof(OrderingResources.SA1203Description), OrderingResources.ResourceManager, typeof(OrderingResources));
33+
private static readonly string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1203.md";
3434

3535
private static readonly DiagnosticDescriptor Descriptor =
3636
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.OrderingRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

StyleCop.Analyzers/StyleCop.Analyzers/OrderingRules/SA1204StaticElementsMustAppearBeforeInstanceElements.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ internal class SA1204StaticElementsMustAppearBeforeInstanceElements : Diagnostic
2929
/// analyzer.
3030
/// </summary>
3131
public const string DiagnosticId = "SA1204";
32-
private const string Title = "Static elements must appear before instance elements";
33-
private const string MessageFormat = "Static members must appear before non-static members";
34-
private const string Description = "A static element is positioned beneath an instance element.";
35-
private const string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1204.md";
32+
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(OrderingResources.SA1204Title), OrderingResources.ResourceManager, typeof(OrderingResources));
33+
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(OrderingResources.SA1204MessageFormat), OrderingResources.ResourceManager, typeof(OrderingResources));
34+
private static readonly LocalizableString Description = new LocalizableResourceString(nameof(OrderingResources.SA1204Description), OrderingResources.ResourceManager, typeof(OrderingResources));
35+
private static readonly string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1204.md";
3636

3737
private static readonly DiagnosticDescriptor Descriptor =
3838
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.OrderingRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

StyleCop.Analyzers/StyleCop.Analyzers/OrderingRules/SA1214ReadonlyElementsMustAppearBeforeNonReadonlyElements.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ internal class SA1214ReadonlyElementsMustAppearBeforeNonReadonlyElements : Diagn
2323
/// <see cref="SA1214ReadonlyElementsMustAppearBeforeNonReadonlyElements"/> analyzer.
2424
/// </summary>
2525
public const string DiagnosticId = "SA1214";
26-
private const string Title = "Readonly fields must appear before non-readonly fields";
27-
private const string MessageFormat = "Readonly fields must appear before non-readonly fields";
28-
private const string Description = "A readonly field is positioned beneath a non-readonly field.";
29-
private const string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1214.md";
26+
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(OrderingResources.SA1214Title), OrderingResources.ResourceManager, typeof(OrderingResources));
27+
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(OrderingResources.SA1214MessageFormat), OrderingResources.ResourceManager, typeof(OrderingResources));
28+
private static readonly LocalizableString Description = new LocalizableResourceString(nameof(OrderingResources.SA1214Description), OrderingResources.ResourceManager, typeof(OrderingResources));
29+
private static readonly string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1214.md";
3030

3131
private static readonly DiagnosticDescriptor Descriptor =
3232
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.OrderingRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

0 commit comments

Comments
 (0)