Skip to content

Commit 9ac3803

Browse files
committed
fixed CA2211 - Non-constant fields should not be visible
1 parent 2eef86e commit 9ac3803

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

.editorconfig

-3
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,6 @@ dotnet_diagnostic.CA2007.severity = warning
169169
# Do not raise reserved exception types
170170
dotnet_diagnostic.CA2201.severity = suggestion
171171

172-
# Non-constant fields should not be visible
173-
dotnet_diagnostic.CA2211.severity = suggestion
174-
175172
# Using directive is unnecessary
176173
dotnet_diagnostic.IDE0005.severity = warning
177174

Microsoft.NET.Build.Containers/KnownStrings.cs

+21-21
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,32 @@ public static class KnownStrings
77
{
88
public static class Properties
99
{
10-
public static string ContainerBaseImage = nameof(ContainerBaseImage);
11-
public static string ContainerRegistry = nameof(ContainerRegistry);
12-
public static string ContainerImageName = nameof(ContainerImageName);
13-
public static string ContainerImageTag = nameof(ContainerImageTag);
14-
public static string ContainerImageTags = nameof(ContainerImageTags);
15-
public static string ContainerWorkingDirectory = nameof(ContainerWorkingDirectory);
16-
public static string ContainerEntrypoint = nameof(ContainerEntrypoint);
17-
public static string UseAppHost = nameof(UseAppHost);
18-
public static string ContainerLabel = nameof(ContainerLabel);
19-
public static string SelfContained = nameof(SelfContained);
20-
public static string ContainerPort = nameof(ContainerPort);
21-
public static string ContainerEnvironmentVariable = nameof(ContainerEnvironmentVariable);
10+
public static readonly string ContainerBaseImage = nameof(ContainerBaseImage);
11+
public static readonly string ContainerRegistry = nameof(ContainerRegistry);
12+
public static readonly string ContainerImageName = nameof(ContainerImageName);
13+
public static readonly string ContainerImageTag = nameof(ContainerImageTag);
14+
public static readonly string ContainerImageTags = nameof(ContainerImageTags);
15+
public static readonly string ContainerWorkingDirectory = nameof(ContainerWorkingDirectory);
16+
public static readonly string ContainerEntrypoint = nameof(ContainerEntrypoint);
17+
public static readonly string UseAppHost = nameof(UseAppHost);
18+
public static readonly string ContainerLabel = nameof(ContainerLabel);
19+
public static readonly string SelfContained = nameof(SelfContained);
20+
public static readonly string ContainerPort = nameof(ContainerPort);
21+
public static readonly string ContainerEnvironmentVariable = nameof(ContainerEnvironmentVariable);
2222

23-
public static string ComputeContainerConfig = nameof(ComputeContainerConfig);
24-
public static string AssemblyName = nameof(AssemblyName);
25-
public static string ContainerBaseRegistry = nameof(ContainerBaseRegistry);
26-
public static string ContainerBaseName = nameof(ContainerBaseName);
27-
public static string ContainerBaseTag = nameof(ContainerBaseTag);
23+
public static readonly string ComputeContainerConfig = nameof(ComputeContainerConfig);
24+
public static readonly string AssemblyName = nameof(AssemblyName);
25+
public static readonly string ContainerBaseRegistry = nameof(ContainerBaseRegistry);
26+
public static readonly string ContainerBaseName = nameof(ContainerBaseName);
27+
public static readonly string ContainerBaseTag = nameof(ContainerBaseTag);
2828

29-
public static string ContainerGenerateLabels = nameof(ContainerGenerateLabels);
29+
public static readonly string ContainerGenerateLabels = nameof(ContainerGenerateLabels);
3030
}
3131

3232
public static class ErrorCodes
3333
{
34-
public static string CONTAINER001 = nameof(CONTAINER001);
35-
public static string CONTAINER004 = nameof(CONTAINER004);
36-
public static string CONTAINER005 = nameof(CONTAINER005);
34+
public static readonly string CONTAINER001 = nameof(CONTAINER001);
35+
public static readonly string CONTAINER004 = nameof(CONTAINER004);
36+
public static readonly string CONTAINER005 = nameof(CONTAINER005);
3737
}
3838
}

Microsoft.NET.Build.Containers/ReferenceParser.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public static class ReferenceParser
200200
/// is anchored and has capturing groups for name, tag, and digest
201201
/// components.
202202
/// </summary>
203-
public static Regex ReferenceRegexp = new(referencePat);
203+
public static readonly Regex ReferenceRegexp = new(referencePat);
204204

205205
/// <summary>
206206
/// identifier is the format for string identifier used as a

0 commit comments

Comments
 (0)