Fix CA1052

This commit is contained in:
RoosterDragon
2023-03-12 12:02:27 +00:00
committed by abcdefg30
parent f336a956cf
commit 0958197df2
12 changed files with 15 additions and 13 deletions

View File

@@ -634,6 +634,9 @@ dotnet_diagnostic.CA1047.severity = warning
# Declare types in namespaces. # Declare types in namespaces.
dotnet_diagnostic.CA1050.severity = warning dotnet_diagnostic.CA1050.severity = warning
# Static holder types should be 'Static' or 'NotInheritable'.
dotnet_diagnostic.CA1052.severity = warning
# Do not hide base class methods. # Do not hide base class methods.
dotnet_diagnostic.CA1061.severity = warning dotnet_diagnostic.CA1061.severity = warning

View File

@@ -69,7 +69,7 @@ namespace OpenRA
// HACK: Temporary placeholder to avoid having to change all the traits that reference this constant. // HACK: Temporary placeholder to avoid having to change all the traits that reference this constant.
// This can be removed after the palette references have been moved from traits to sequences. // This can be removed after the palette references have been moved from traits to sequences.
public class TileSet public static class TileSet
{ {
public const string TerrainPaletteInternalName = "terrain"; public const string TerrainPaletteInternalName = "terrain";
} }

View File

@@ -19,7 +19,7 @@ using ICSharpCode.SharpZipLib.Zip;
namespace OpenRA.Network namespace OpenRA.Network
{ {
public class GeoIP public static class GeoIP
{ {
sealed class IP2LocationReader sealed class IP2LocationReader
{ {

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Network
{ {
public enum NatStatus { Enabled, Disabled, NotSupported } public enum NatStatus { Enabled, Disabled, NotSupported }
public class Nat public static class Nat
{ {
public static NatStatus Status => NatUtility.IsSearching ? natDevice != null ? NatStatus.Enabled : NatStatus.NotSupported : NatStatus.Disabled; public static NatStatus Status => NatUtility.IsSearching ? natDevice != null ? NatStatus.Enabled : NatStatus.NotSupported : NatStatus.Disabled;

View File

@@ -14,7 +14,7 @@ using System.Net.Http;
namespace OpenRA.Support namespace OpenRA.Support
{ {
public class HttpClientFactory public static class HttpClientFactory
{ {
#if NET5_0_OR_GREATER #if NET5_0_OR_GREATER
const int MaxConnectionPerServer = 20; const int MaxConnectionPerServer = 20;

View File

@@ -13,7 +13,7 @@ using System.IO;
namespace OpenRA.Mods.Common.FileFormats namespace OpenRA.Mods.Common.FileFormats
{ {
public class ImaAdpcmReader public static class ImaAdpcmReader
{ {
static readonly int[] IndexAdjust = { -1, -1, -1, -1, 2, 4, 6, 8 }; static readonly int[] IndexAdjust = { -1, -1, -1, -1, 2, 4, 6, 8 };
static readonly int[] StepTable = static readonly int[] StepTable =

View File

@@ -15,7 +15,7 @@ using System;
namespace OpenRA.Mods.Common.FileFormats namespace OpenRA.Mods.Common.FileFormats
{ {
public class WestwoodCompressedReader public static class WestwoodCompressedReader
{ {
static readonly int[] AudWsStepTable2 = { -2, -1, 0, 1 }; static readonly int[] AudWsStepTable2 = { -2, -1, 0, 1 };
static readonly int[] AudWsStepTable4 = { -9, -8, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 8 }; static readonly int[] AudWsStepTable4 = { -9, -8, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 8 };

View File

@@ -16,7 +16,7 @@ using FS = OpenRA.FileSystem.FileSystem;
namespace OpenRA.Mods.Common.Installer namespace OpenRA.Mods.Common.Installer
{ {
public class InstallerUtils public static class InstallerUtils
{ {
public static bool IsValidSourcePath(string path, ModContent.ModSource source) public static bool IsValidSourcePath(string path, ModContent.ModSource source)
{ {

View File

@@ -19,7 +19,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Lint namespace OpenRA.Mods.Common.Lint
{ {
public class LintExts public static class LintExts
{ {
public static IEnumerable<string> GetFieldValues(object ruleInfo, FieldInfo fieldInfo, public static IEnumerable<string> GetFieldValues(object ruleInfo, FieldInfo fieldInfo,
LintDictionaryReference dictionaryReference = LintDictionaryReference.None) LintDictionaryReference dictionaryReference = LintDictionaryReference.None)

View File

@@ -27,9 +27,8 @@ namespace OpenRA.Mods.Common.Traits
public override object Create(ActorInitializer init) { return Encyclopedia.Instance; } public override object Create(ActorInitializer init) { return Encyclopedia.Instance; }
} }
public class Encyclopedia public readonly struct Encyclopedia
{ {
public static readonly Encyclopedia Instance = new(); public static readonly object Instance = default(Encyclopedia);
Encyclopedia() { }
} }
} }

View File

@@ -11,7 +11,7 @@
namespace OpenRA.Mods.Common.Traits.Render namespace OpenRA.Mods.Common.Traits.Render
{ {
public class RenderUtils public static class RenderUtils
{ {
public static int ZOffsetFromCenter(Actor self, WPos pos, int offset) public static int ZOffsetFromCenter(Actor self, WPos pos, int offset)
{ {

View File

@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
} }
} }
public class OrderButtonsChromeUtils public static class OrderButtonsChromeUtils
{ {
public static void BindOrderButton<T>(World world, ButtonWidget w, string icon) public static void BindOrderButton<T>(World world, ButtonWidget w, string icon)
where T : IOrderGenerator, new() where T : IOrderGenerator, new()