Enable CA1052: Static holder types should be Static or NotInheritable (#14483)
* Enable CA1052: Static holder types should be Static or NotInheritable https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/CA1052 * Fix SA1505 https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1505.md
This commit is contained in:
parent
0bcc1d4c35
commit
50fd950920
@ -100,7 +100,8 @@ dotnet_diagnostic.CA1050.severity = warning
|
||||
dotnet_diagnostic.CA1051.severity = silent
|
||||
|
||||
# CA1052: Static holder types should be Static or NotInheritable
|
||||
dotnet_diagnostic.CA1052.severity = none
|
||||
dotnet_diagnostic.CA1052.severity = warning
|
||||
dotnet_code_quality.ca1052.api_surface = private, internal
|
||||
|
||||
# CA1054: URI-like parameters should not be strings
|
||||
dotnet_diagnostic.CA1054.severity = none
|
||||
|
@ -428,15 +428,8 @@ namespace Microsoft.PowerShell.Commands
|
||||
|
||||
#region Win32 interop helper
|
||||
|
||||
internal class NativeMethods
|
||||
internal static class NativeMethods
|
||||
{
|
||||
/// <summary>
|
||||
/// Private constructor to prevent instantiation.
|
||||
/// </summary>
|
||||
private NativeMethods()
|
||||
{
|
||||
}
|
||||
|
||||
#region Native DLL locations
|
||||
|
||||
private const string SetDynamicTimeZoneApiDllName = "api-ms-win-core-timezone-l1-1-0.dll";
|
||||
|
@ -519,12 +519,8 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// <summary>
|
||||
/// Native methods for dealing with COM objects.
|
||||
/// </summary>
|
||||
internal class NewObjectNativeMethods
|
||||
internal static class NewObjectNativeMethods
|
||||
{
|
||||
private NewObjectNativeMethods()
|
||||
{
|
||||
}
|
||||
|
||||
/// Return Type: HRESULT->LONG->int
|
||||
[DllImport(PinvokeDllNames.CLSIDFromProgIDDllName)]
|
||||
internal static extern int CLSIDFromProgID([MarshalAs(UnmanagedType.LPWStr)] string lpszProgID, out Guid pclsid);
|
||||
|
@ -58,7 +58,7 @@ namespace Microsoft.PowerShell
|
||||
Dispose();
|
||||
}
|
||||
|
||||
private class PropVariantNativeMethods
|
||||
private static class PropVariantNativeMethods
|
||||
{
|
||||
[DllImport("Ole32.dll", PreserveSig = false)]
|
||||
internal static extern void PropVariantClear([In, Out] PropVariant pvar);
|
||||
|
@ -22,7 +22,7 @@ using System.Text;
|
||||
|
||||
namespace System.Diagnostics.Eventing.Reader
|
||||
{
|
||||
internal class NativeWrapper
|
||||
internal static class NativeWrapper
|
||||
{
|
||||
public class SystemProperties
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
internal class NTVerpVars
|
||||
internal static class NTVerpVars
|
||||
{
|
||||
internal const int PRODUCTMAJORVERSION = 10;
|
||||
internal const int PRODUCTMINORVERSION = 0;
|
||||
|
@ -417,7 +417,7 @@ namespace System.Management.Automation.ComInterop
|
||||
}
|
||||
}
|
||||
|
||||
internal class VarEnumSelector
|
||||
internal static class VarEnumSelector
|
||||
{
|
||||
internal static Type GetTypeForVarEnum(VarEnum vt)
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ namespace System.Management.Automation
|
||||
/// <summary>
|
||||
/// Defines a utility class that is used by COM adapter.
|
||||
/// </summary>
|
||||
internal class ComUtil
|
||||
internal static class ComUtil
|
||||
{
|
||||
// HResult error code '-2147352573' - Member not found.
|
||||
internal const int DISP_E_MEMBERNOTFOUND = unchecked((int)0x80020003);
|
||||
|
@ -70,7 +70,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
}
|
||||
|
||||
internal class ExperimentalFeatureConfigHelper
|
||||
internal static class ExperimentalFeatureConfigHelper
|
||||
{
|
||||
internal static void UpdateConfig(PSCmdlet cmdlet, string[] name, ConfigScope scope, bool enable)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ using Debug = System.Management.Automation.Diagnostics;
|
||||
|
||||
namespace System.Management.Automation.Runspaces
|
||||
{
|
||||
internal class EarlyStartup
|
||||
internal static class EarlyStartup
|
||||
{
|
||||
internal static void Init()
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ namespace System.Management.Automation
|
||||
/// Changes to these type of modules will not be re-analyzed, unless the user re-imports the module,
|
||||
/// or runs Get-Module -List.
|
||||
/// </summary>
|
||||
internal class AnalysisCache
|
||||
internal static class AnalysisCache
|
||||
{
|
||||
private static readonly AnalysisCacheData s_cacheData = AnalysisCacheData.Get();
|
||||
|
||||
|
@ -25,7 +25,7 @@ using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
internal class RemoteDiscoveryHelper
|
||||
internal static class RemoteDiscoveryHelper
|
||||
{
|
||||
#region PSRP
|
||||
|
||||
|
@ -3670,7 +3670,7 @@ namespace System.Management.Automation
|
||||
/// <summary>
|
||||
/// /// This class is used in PSMemberInfoInternalCollection and ReadOnlyPSMemberInfoCollection.
|
||||
/// </summary>
|
||||
internal class MemberMatch
|
||||
internal static class MemberMatch
|
||||
{
|
||||
internal static WildcardPattern GetNamePattern(string name)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ namespace System.Management.Automation
|
||||
/// <summary>
|
||||
/// Helper class for WinRT types.
|
||||
/// </summary>
|
||||
internal class WinRTHelper
|
||||
internal static class WinRTHelper
|
||||
{
|
||||
internal static bool IsWinRTType(Type type)
|
||||
{
|
||||
|
@ -224,7 +224,7 @@ namespace System.Management.Automation.Interpreter
|
||||
}
|
||||
}
|
||||
|
||||
internal class ScriptingRuntimeHelpers
|
||||
internal static class ScriptingRuntimeHelpers
|
||||
{
|
||||
internal static object Int32ToObject(int i)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ using Microsoft.PowerShell;
|
||||
|
||||
namespace System.Management.Automation.Language
|
||||
{
|
||||
internal class TypeDefiner
|
||||
internal static class TypeDefiner
|
||||
{
|
||||
internal const string DynamicClassAssemblyName = "PowerShell Class Assembly";
|
||||
internal const string DynamicClassAssemblyFullNamePrefix = "PowerShell Class Assembly,";
|
||||
|
@ -671,7 +671,7 @@ namespace System.Management.Automation.Language
|
||||
}
|
||||
}
|
||||
|
||||
internal class TypeCache
|
||||
internal static class TypeCache
|
||||
{
|
||||
private class KeyComparer : IEqualityComparer<Tuple<ITypeName, TypeResolutionState>>
|
||||
{
|
||||
|
@ -1855,7 +1855,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// <summary>
|
||||
/// Utility methods for configuration file commands.
|
||||
/// </summary>
|
||||
internal class SessionConfigurationUtils
|
||||
internal static class SessionConfigurationUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// This routine builds a fragment of the config file
|
||||
|
@ -24,7 +24,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// guarantees that transmitting on the wire will not change the encoded
|
||||
/// object's type.
|
||||
/// </summary>
|
||||
internal class RemoteHostEncoder
|
||||
internal static class RemoteHostEncoder
|
||||
{
|
||||
/// <summary>
|
||||
/// Is known type.
|
||||
|
@ -444,7 +444,7 @@ namespace System.Management.Automation.Language
|
||||
}
|
||||
}
|
||||
|
||||
internal class BinderUtils
|
||||
internal static class BinderUtils
|
||||
{
|
||||
internal static BindingRestrictions GetVersionCheck(DynamicMetaObjectBinder binder, int expectedVersionNumber)
|
||||
{
|
||||
|
@ -1789,7 +1789,7 @@ namespace System.Management.Automation
|
||||
return null;
|
||||
}
|
||||
|
||||
private class SuspiciousContentChecker
|
||||
private static class SuspiciousContentChecker
|
||||
{
|
||||
// Based on a (bad) random number generator, but good enough
|
||||
// for our simple needs.
|
||||
|
@ -78,7 +78,7 @@ namespace System.Management.Automation.Internal
|
||||
/// <summary>
|
||||
/// Used to create a CabinetExtractor class.
|
||||
/// </summary>
|
||||
internal class CabinetExtractorFactory
|
||||
internal static class CabinetExtractorFactory
|
||||
{
|
||||
private static readonly ICabinetExtractorLoader s_cabinetLoader;
|
||||
internal static readonly ICabinetExtractor EmptyExtractor = new EmptyCabinetExtractor();
|
||||
|
@ -40,7 +40,7 @@ namespace System.Management.Automation.Help
|
||||
/// is present in the box. This class mimics the exact same structure as that of a MAML
|
||||
/// node, so that the default UX does not introduce regressions.
|
||||
/// </summary>
|
||||
internal class DefaultCommandHelpObjectBuilder
|
||||
internal static class DefaultCommandHelpObjectBuilder
|
||||
{
|
||||
internal static readonly string TypeNameForDefaultHelp = "ExtendedCmdletHelpInfo";
|
||||
/// <summary>
|
||||
|
@ -9,7 +9,7 @@ using Microsoft.PowerShell.Commands;
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
internal class HelpUtils
|
||||
internal static class HelpUtils
|
||||
{
|
||||
private static string userHomeHelpPath = null;
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace System.Management.Automation
|
||||
/// <summary>
|
||||
/// The MamlUtil class.
|
||||
/// </summary>
|
||||
internal class MamlUtil
|
||||
internal static class MamlUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// Takes Name value from maml2 and overrides it in maml1.
|
||||
|
@ -1334,7 +1334,7 @@ namespace System.Management.Automation
|
||||
Decryption
|
||||
}
|
||||
|
||||
internal class AmsiUtils
|
||||
internal static class AmsiUtils
|
||||
{
|
||||
private static string GetProcessHostName(string processName)
|
||||
{
|
||||
@ -1580,7 +1580,7 @@ namespace System.Management.Automation
|
||||
public static bool AmsiInitialized = false;
|
||||
public static bool AmsiCleanedUp = false;
|
||||
|
||||
internal class AmsiNativeMethods
|
||||
internal static class AmsiNativeMethods
|
||||
{
|
||||
internal enum AMSI_RESULT
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ using BOOL = System.UInt32;
|
||||
namespace System.Management.Automation.Security
|
||||
{
|
||||
// Crypto API native constants
|
||||
internal partial class NativeConstants
|
||||
internal static partial class NativeConstants
|
||||
{
|
||||
internal const int CRYPT_OID_INFO_OID_KEY = 1;
|
||||
internal const int CRYPT_OID_INFO_NAME_KEY = 2;
|
||||
|
@ -491,7 +491,7 @@ namespace System.Management.Automation.Security
|
||||
/// <summary>
|
||||
/// Native constants for dealing with the lockdown policy.
|
||||
/// </summary>
|
||||
internal class WldpNativeConstants
|
||||
internal static class WldpNativeConstants
|
||||
{
|
||||
internal const uint WLDP_HOST_INFORMATION_REVISION = 0x00000001;
|
||||
|
||||
@ -541,7 +541,7 @@ namespace System.Management.Automation.Security
|
||||
/// <summary>
|
||||
/// Native methods for dealing with the lockdown policy.
|
||||
/// </summary>
|
||||
internal class WldpNativeMethods
|
||||
internal static class WldpNativeMethods
|
||||
{
|
||||
/// Return Type: HRESULT->LONG->int
|
||||
/// pHostInformation: PWLDP_HOST_INFORMATION->_WLDP_HOST_INFORMATION*
|
||||
|
@ -8,7 +8,7 @@ using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
internal class PlatformInvokes
|
||||
internal static class PlatformInvokes
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class FILETIME
|
||||
|
@ -560,7 +560,7 @@ namespace System.Management.Automation
|
||||
/// A simple implementation of CRC32.
|
||||
/// See "CRC-32 algorithm" in https://en.wikipedia.org/wiki/Cyclic_redundancy_check.
|
||||
/// </summary>
|
||||
internal class CRC32Hash
|
||||
internal static class CRC32Hash
|
||||
{
|
||||
// CRC-32C polynomial representations
|
||||
private const uint polynomial = 0x1EDC6F41;
|
||||
|
Loading…
Reference in New Issue
Block a user