Enable SA1106: Code should not contain empty statements (#13964)

https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1106.md
This commit is contained in:
xtqqczze
2020-11-21 19:26:44 +05:00
committed by GitHub
parent fcafb7f57d
commit cba73e724f
38 changed files with 77 additions and 77 deletions
+1 -1
View File
@@ -1116,7 +1116,7 @@ dotnet_diagnostic.SA1104.severity = none
dotnet_diagnostic.SA1105.severity = none
# SA1106: Code should not contain empty statements
dotnet_diagnostic.SA1106.severity = none
dotnet_diagnostic.SA1106.severity = warning
# SA1107: Code should not contain multiple statements on one line
dotnet_diagnostic.SA1107.severity = none
@@ -24,7 +24,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
Wsman
};
}
/// <summary>
/// The Cmdlet allows the IT Pro to create a CimSessionOptions object that she/he
@@ -225,7 +225,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
// [FieldOffset(4), MarshalAs(UnmanagedType.LPWStr)]
// public string WideStringValue;
};
}
[StructLayout(LayoutKind.Sequential)]
private struct PDH_FMT_COUNTERVALUE_DOUBLE
@@ -233,7 +233,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
public uint CStatus;
public double doubleValue;
};
}
[StructLayout(LayoutKind.Sequential)]
private struct PDH_FMT_COUNTERVALUE_UNICODE
@@ -242,7 +242,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
[MarshalAs(UnmanagedType.LPWStr)]
public string WideStringValue;
};
}
[StructLayout(LayoutKind.Sequential)]
private struct PDH_RAW_COUNTER
@@ -54,7 +54,7 @@ namespace Microsoft.PowerShell.Commands
/// Select the processes specified as input.
/// </summary>
ByInput
};
}
/// <summary>
/// The current process selection mode.
/// </summary>
@@ -179,7 +179,7 @@ namespace Microsoft.PowerShell.Commands
/// Select services by Service name.
/// </summary>
ServiceName = 3
};
}
/// <summary>
/// Holds the selection mode setting.
/// </summary>
@@ -2706,7 +2706,7 @@ namespace Microsoft.PowerShell.Commands
{
[MarshalAs(UnmanagedType.LPWStr)]
internal string lpDescription;
};
}
[StructLayout(LayoutKind.Sequential)]
internal struct QUERY_SERVICE_CONFIG
@@ -2720,13 +2720,13 @@ namespace Microsoft.PowerShell.Commands
[MarshalAs(UnmanagedType.LPWStr)] internal string lpDependencies;
[MarshalAs(UnmanagedType.LPWStr)] internal string lpServiceStartName;
[MarshalAs(UnmanagedType.LPWStr)] internal string lpDisplayName;
};
}
[StructLayout(LayoutKind.Sequential)]
internal struct SERVICE_DELAYED_AUTO_START_INFO
{
internal bool fDelayedAutostart;
};
}
[DllImport(PinvokeDllNames.CreateServiceWDllName, CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern
@@ -22,7 +22,7 @@ namespace Microsoft.PowerShell.Commands
/// <summary>Breakpoint on a command</summary>
Command
};
}
/// <summary>
/// This class implements Get-PSBreakpoint.
@@ -40,7 +40,7 @@ namespace Microsoft.PowerShell
/// The node will be displayed the same as Full, plus, the whole StatusDescription and CurrentOperation will be displayed (in multiple lines if needed).
/// </summary>
FullPlus = 4,
};
}
/// <summary>
/// Constructs an instance from a ProgressRecord.
@@ -866,7 +866,7 @@ namespace System.Diagnostics.Eventing
[FieldOffset(12)]
public UInt32 Type;
};
}
[DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)]
[SecurityCritical]
@@ -5434,14 +5434,14 @@ namespace Microsoft.WSMan.Management
{
GetChildItems,
GetChildNames
};
}
private enum WsManElementObjectTypes
{
WSManConfigElement,
WSManConfigContainerElement,
WSManConfigLeafElement
};
}
#region def
private static readonly string[] WinrmRootName = new string[] { "winrm/Config" };
+1 -1
View File
@@ -376,7 +376,7 @@ namespace Microsoft.WSMan.Management
/// <summary><para><c>ProxyAuthenticationUseDigest</c> method of <c>IWSManConnectionOptionsEx2</c> interface.</para></summary>
[DispId(11)]
int ProxyAuthenticationUseDigest();
};
}
#endregion IWSManConnectionOptions
@@ -44,7 +44,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
/// </summary>
internal class XmlLoaderLoggerEntry
{
internal enum EntryType { Error, Trace };
internal enum EntryType { Error, Trace }
/// <summary>
/// Type of information being logged.
@@ -13,7 +13,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
{
internal enum LoadingResult { NoError, AssemblyNotFound, ResourceNotFound, StringNotFound }
internal enum AssemblyBindingStatus { NotFound, FoundInGac, FoundInPath };
internal enum AssemblyBindingStatus { NotFound, FoundInGac, FoundInPath }
internal string GetTextTokenString(TextToken tt)
{
@@ -9,5 +9,5 @@ namespace System.Management.Automation.ComInterop
{
public Guid SourceIID;
public int Dispid;
};
}
}
@@ -1699,5 +1699,5 @@ namespace System.Management.Automation
/// Engine is stopped.
/// </summary>
Stopped = 4
};
}
}
@@ -5779,7 +5779,7 @@ namespace System.Management.Automation
return CacheConversion(fromType, toType, converter, rank);
}
internal class Null { };
internal class Null { }
private static IConversionData FigureConversionFromNull(Type toType)
{
@@ -254,7 +254,7 @@ namespace System.Management.Automation
Arguments = 0x02,
InputFormat = 0x04,
OutputFormat = 0x08
};
}
/// <summary>
/// Handles error handling if some parameter is specified more than once.
@@ -3384,7 +3384,7 @@ namespace System.Management.Automation
No,
YesToAll,
NoToAll
};
}
internal ContinueStatus lastShouldProcessContinueStatus = ContinueStatus.Yes;
internal ContinueStatus lastErrorContinueStatus = ContinueStatus.Yes;
@@ -32,7 +32,7 @@ namespace System.Management.Automation
{
Text,
Xml
};
}
/// <summary>
/// Different streams produced by minishell output.
@@ -1419,7 +1419,7 @@ namespace System.Management.Automation
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public string szTypeName;
};
}
private const uint SHGFI_EXETYPE = 0x000002000; // flag used to ask to return exe type
@@ -16,7 +16,7 @@ namespace System.Management.Automation.Internal
Error,
Warning,
Information
};
}
/// <summary>
/// Pipe provides a way to stitch two commands.
@@ -308,5 +308,5 @@ namespace System.Management.Automation
internal const string MonadNamespacePrefix = "ps";
#endregion namespace values
};
}
}
@@ -50,7 +50,7 @@ namespace System.Management.Automation
/// Stop executing the script.
/// </summary>
Stop = 4,
};
}
/// <summary>
/// Arguments for the DebuggerStop event.
@@ -112,7 +112,7 @@ namespace System.Management.Automation
/// leave pending runspace debug sessions suspended until a debugger is attached.
/// </summary>
internal bool SuspendRemote { get; set; }
};
}
/// <summary>
/// Kinds of breakpoint updates.
@@ -135,7 +135,7 @@ namespace System.Management.Automation
/// A breakpoint was disabled.
/// </summary>
Disabled = 3
};
}
/// <summary>
/// Arguments for the BreakpointUpdated event.
@@ -166,7 +166,7 @@ namespace System.Management.Automation
/// Gets the current breakpoint count.
/// </summary>
public int BreakpointCount { get; }
};
}
#region PSJobStartEventArgs
@@ -292,7 +292,7 @@ namespace System.Management.Automation
/// PowerShell remote script debugging.
/// </summary>
RemoteScript = 0x4
};
}
/// <summary>
/// Defines unhandled breakpoint processing behavior.
@@ -1592,7 +1592,7 @@ namespace System.Management.Automation
internal bool IsFrameHidden { get; set; }
internal bool TopFrameAtBreakpoint { get; set; }
};
}
private struct CallStackList
{
@@ -226,7 +226,7 @@ namespace System.Management.Automation.Runspaces
/// This option is not valid for asynchronous calls
/// </remarks>
UseCurrentThread = 3
};
}
/// <summary>
/// Defines type which has information about RunspaceState and
@@ -41,7 +41,7 @@ namespace System.Management.Automation.Language
/// Name may be optionally present, expression or bare word.
/// </summary>
OptionalName = 4,
};
}
/// <summary>
/// Defines the body mode for a dynamic keyword. It can be a scriptblock, hashtable or command which means no body.
@@ -43,7 +43,7 @@ namespace System.Management.Automation
/// Specifies culture-invariant matching.
/// </summary>
CultureInvariant = 4
};
}
/// <summary>
/// Represents a wildcard pattern.
@@ -729,7 +729,7 @@ namespace System.Management.Automation
return e;
}
};
}
/// <summary>
/// Convert a string with wild cards into its equivalent regex.
@@ -977,7 +977,7 @@ namespace System.Management.Automation.Runspaces.Internal
AutoDisconnectStarting = 4,
AutoDisconnectSucceeded = 5,
InternalErrorAbort = 6
};
}
/// <summary>
/// PSConnectionRetryStatusEventArgs.
@@ -2297,7 +2297,7 @@ namespace System.Management.Automation.Runspaces
case '"':
// Special case for arguments within quotes
// Just return argument value within the quotes
while ((++i < argsLength) && argsToParse[i] != '"') { };
while ((++i < argsLength) && argsToParse[i] != '"') { }
if (iStart < argsLength - 1)
{
iStart++;
@@ -2307,12 +2307,12 @@ namespace System.Management.Automation.Runspaces
default:
// Common case for parsing arguments with space character delimiter
while ((++i < argsLength) && argsToParse[i] != ' ') { };
while ((++i < argsLength) && argsToParse[i] != ' ') { }
break;
}
argvList.Add(argsToParse.Substring(iStart, (i-iStart)));
while ((++i < argsLength) && argsToParse[i] == ' ') { };
while ((++i < argsLength) && argsToParse[i] == ' ') { }
}
return argvList.ToArray();
@@ -97,7 +97,7 @@ namespace System.Management.Automation.Remoting
AutoDisconnectStarting = 4,
AutoDisconnectSucceeded = 5,
InternalErrorAbort = 6
};
}
/// <summary>
/// ConnectionStatusEventArgs.
@@ -612,7 +612,7 @@ namespace System.Management.Automation.Remoting.Client
WSMAN_DATA_TYPE_BINARY = 2,
WSMAN_DATA_TYPE_WS_XML_READER = 3,
WSMAN_DATA_TYPE_DWORD = 4
};
}
[StructLayout(LayoutKind.Sequential)]
internal class WSManDataStruct
@@ -1248,7 +1248,7 @@ namespace System.Management.Automation
/// The PreProcessCommandResult used for managing breakpoints.
/// </summary>
BreakpointManagement,
};
}
private class DebuggerCommandArgument
{
@@ -791,7 +791,7 @@ namespace System.Management.Automation
List,
Enumerable,
None
};
}
/// <summary>
/// This internal helper class provides methods for serializing mshObject.
@@ -164,7 +164,7 @@ namespace System.Management.Automation.Internal
_fdiNotifyHandle.Free();
}
}
};
}
// CabinetExtractor loader implementation
internal class CabinetExtractorLoader : ICabinetExtractorLoader
@@ -188,7 +188,7 @@ namespace System.Management.Automation.Internal
{
return s_extractorInstance;
}
};
}
internal static class CabinetNativeApi
{
@@ -589,7 +589,7 @@ namespace System.Management.Automation.Internal
internal short iCabinet; // USHORT
internal short iFolder; // USHORT
internal int fdie; // FDIERROR
};
}
internal enum FdiNotificationType : int
{
@@ -607,7 +607,7 @@ namespace System.Management.Automation.Internal
internal int erfOper;
internal int erfType;
internal bool fError;
};
}
internal sealed class FdiContextHandle : SafeHandleZeroOrMinusOneIsInvalid
{
@@ -1085,7 +1085,7 @@ namespace System.Management.Automation
/// Informational.
/// </summary>
Informational
};
}
/// <summary>
/// Enum for command states.
@@ -1103,7 +1103,7 @@ namespace System.Management.Automation
/// <summary>
/// </summary>
Terminated = 2
};
}
/// <summary>
/// Enum for provider states.
@@ -1117,7 +1117,7 @@ namespace System.Management.Automation
/// <summary>
/// </summary>
Stopped = 1,
};
}
#endregion
}
@@ -1515,7 +1515,7 @@ namespace Microsoft.PowerShell.Commands
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_LEADBYTES)]
public byte[] LeadBytes;
};
}
/// <summary>
/// Get information on a named code page.
@@ -2721,7 +2721,7 @@ namespace Microsoft.PowerShell.Commands
SymbolicLink,
Junction,
HardLink
};
}
private static ItemType GetItemType(string input)
{
@@ -71,7 +71,7 @@ namespace System.Management.Automation
/// with the current system.
/// </summary>
Incompatible
};
}
/// <summary>
/// Defines the valid types of signatures.
@@ -92,7 +92,7 @@ namespace System.Management.Automation
/// The signature is a catalog signature.
/// </summary>
Catalog = 2
};
}
/// <summary>
/// Represents a digital signature on a signed
@@ -389,5 +389,5 @@ namespace System.Management.Automation
return message;
}
};
}
}
@@ -63,7 +63,7 @@ namespace Microsoft.PowerShell
/// Default - The most restrictive policy available.
/// </summary>
Default = Restricted
};
}
/// <summary>
/// Defines the available configuration scopes for an execution
@@ -556,7 +556,7 @@ namespace System.Management.Automation.Security
{
CRYPTUI_WIZ_NO_UI = 0x0001
// other flags not used
};
}
[StructLayout(LayoutKind.Sequential)]
internal struct CRYPTUI_WIZ_DIGITAL_SIGN_INFO
@@ -575,14 +575,14 @@ namespace System.Management.Automation.Security
internal DWORD dwAdditionalCertChoice;
internal IntPtr pSignExtInfo; // PCCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO
};
}
[Flags]
internal enum SignInfoSubjectChoice
{
CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_FILE = 0x01
// CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_BLOB = 0x02 NotUsed
};
}
[Flags]
internal enum SignInfoCertChoice
@@ -590,14 +590,14 @@ namespace System.Management.Automation.Security
CRYPTUI_WIZ_DIGITAL_SIGN_CERT = 0x01
// CRYPTUI_WIZ_DIGITAL_SIGN_STORE = 0x02, NotUsed
// CRYPTUI_WIZ_DIGITAL_SIGN_PVK = 0x03, NotUsed
};
}
[Flags]
internal enum SignInfoAdditionalCertChoice
{
CRYPTUI_WIZ_DIGITAL_SIGN_ADD_CHAIN = 1,
CRYPTUI_WIZ_DIGITAL_SIGN_ADD_CHAIN_NO_ROOT = 2
};
}
[StructLayout(LayoutKind.Sequential)]
internal struct CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO
@@ -618,7 +618,7 @@ namespace System.Management.Automation.Security
internal IntPtr hAdditionalCertStoreNotUsed; // HCERTSTORE
internal IntPtr psAuthenticatedNotUsed; // PCRYPT_ATTRIBUTES
internal IntPtr psUnauthenticatedNotUsed; // PCRYPT_ATTRIBUTES
};
}
[ArchitectureSensitive]
internal static CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO
@@ -806,7 +806,7 @@ namespace System.Management.Automation.Security
internal IntPtr hFileNotUsed; // optional, HANDLE to pcwszFilePath
internal IntPtr pgKnownSubjectNotUsed; // optional: GUID* : fill if the
// subject type is known
};
}
[StructLayoutAttribute(LayoutKind.Sequential)]
internal struct WINTRUST_BLOB_INFO
@@ -871,7 +871,7 @@ namespace System.Management.Automation.Security
WTD_UI_NONE = 2,
WTD_UI_NOBAD = 3,
WTD_UI_NOGOOD = 4
};
}
[Flags]
internal enum WintrustUnionChoice
@@ -881,7 +881,7 @@ namespace System.Management.Automation.Security
WTD_CHOICE_BLOB = 3,
// WTD_CHOICE_SIGNER = 4,
// WTD_CHOICE_CERT = 5,
};
}
[Flags]
internal enum WintrustProviderFlags
@@ -899,7 +899,7 @@ namespace System.Management.Automation.Security
WTD_USE_DEFAULT_OSVER_CHECK = 0x00000400,
WTD_LIFETIME_SIGNING_FLAG = 0x00000800,
WTD_CACHE_ONLY_URL_RETRIEVAL = 0x00001000
};
}
[Flags]
internal enum WintrustAction
@@ -909,7 +909,7 @@ namespace System.Management.Automation.Security
WTD_STATEACTION_CLOSE = 0x00000002,
WTD_STATEACTION_AUTO_CACHE = 0x00000003,
WTD_STATEACTION_AUTO_CACHE_FLUSH = 0x00000004
};
}
[StructLayoutAttribute(LayoutKind.Explicit)]
internal struct WinTrust_Choice
@@ -1103,7 +1103,7 @@ namespace System.Management.Automation.Security
private DWORD _dwCtlError;
private BOOL _fIsCyclic;
private IntPtr _pChainElement; // PCERT_CHAIN_ELEMENT
};
}
[StructLayout(LayoutKind.Sequential)]
internal struct CRYPT_PROVIDER_SGNR
@@ -1118,7 +1118,7 @@ namespace System.Management.Automation.Security
internal DWORD csCounterSigners;
internal IntPtr pasCounterSigners; // CRYPT_PROVIDER_SGNR*
private IntPtr _pChainContext; // PCCERT_CHAIN_CONTEXT
};
}
[DllImport("wintrust.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern
@@ -1210,7 +1210,7 @@ namespace System.Management.Automation.Security
// [MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr, SizeParamIndex=0)]
// internal string[] rgpszUsageIdentifier; // LPSTR*
internal IntPtr rgpszUsageIdentifier;
};
}
internal enum SIGNATURE_STATE
{
@@ -1967,7 +1967,7 @@ namespace System.Management.Automation.Security
private string _pwszResultDir;
private IntPtr _hCATStore;
};
}
[StructLayout(LayoutKind.Sequential)]
internal struct CRYPTCATMEMBER
@@ -1988,7 +1988,7 @@ namespace System.Management.Automation.Security
internal IntPtr hReserved;
internal CRYPT_ATTR_BLOB sEncodedIndirectData;
internal CRYPT_ATTR_BLOB sEncodedMemberInfo;
};
}
[StructLayout(LayoutKind.Sequential)]
internal struct CRYPTCATATTRIBUTE
@@ -2002,7 +2002,7 @@ namespace System.Management.Automation.Security
internal DWORD cbValue;
internal System.IntPtr pbValue;
private DWORD _dwReserved;
};
}
[StructLayout(LayoutKind.Sequential)]
internal struct CRYPTCATSTORE
@@ -2020,7 +2020,7 @@ namespace System.Management.Automation.Security
private IntPtr _hAttrs;
private IntPtr _hCryptMsg;
private IntPtr _hSorted;
};
}
[DllImport("wintrust.dll", CharSet = CharSet.Unicode)]
internal static extern IntPtr CryptCATCDFOpen(
@@ -32,7 +32,7 @@ namespace System.Management.Automation
{
return ((long)dwHighDateTime << 32) + dwLowDateTime;
}
};
}
[Flags]
// dwDesiredAccess of CreateFile