mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix CA1822: Mark members as static part 3 (#14226)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822
This commit is contained in:
+1
-1
@@ -237,7 +237,7 @@ namespace Microsoft.PowerShell.Cmdletization
|
||||
return methodInvocationJob;
|
||||
}
|
||||
|
||||
private void HandleJobOutput(Job job, TSession sessionForJob, bool discardNonPipelineResults, Action<PSObject> outputAction)
|
||||
private static void HandleJobOutput(Job job, TSession sessionForJob, bool discardNonPipelineResults, Action<PSObject> outputAction)
|
||||
{
|
||||
Action<PSObject> processOutput =
|
||||
(PSObject pso) =>
|
||||
|
||||
+2
-2
@@ -154,7 +154,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
private bool IsValidPattern(string input)
|
||||
private static bool IsValidPattern(string input)
|
||||
{
|
||||
return Regex.IsMatch(input, @"^[a-z]{1}$|^[a-z]{1}:$|^[a-z]{1}:\\$", RegexOptions.IgnoreCase);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// </summary>
|
||||
/// <param name="driveName"></param>
|
||||
/// <returns></returns>
|
||||
private string GetDrivePath(string driveName)
|
||||
private static string GetDrivePath(string driveName)
|
||||
{
|
||||
string drivePath;
|
||||
if (driveName.EndsWith(":\\", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@@ -1639,7 +1639,7 @@ $result
|
||||
/// <param name="HasSucceeded"></param>
|
||||
/// <param name="computername"></param>
|
||||
/// <returns></returns>
|
||||
private string FormatLine(string HasSucceeded, string computername)
|
||||
private static string FormatLine(string HasSucceeded, string computername)
|
||||
{
|
||||
return StringUtil.Format(MatchFormat, HasSucceeded, computername);
|
||||
}
|
||||
@@ -1683,7 +1683,7 @@ $result
|
||||
/// <param name="newcomputername"></param>
|
||||
/// <param name="oldcomputername"></param>
|
||||
/// <returns></returns>
|
||||
private string FormatLine(string HasSucceeded, string newcomputername, string oldcomputername)
|
||||
private static string FormatLine(string HasSucceeded, string newcomputername, string oldcomputername)
|
||||
{
|
||||
return StringUtil.Format(MatchFormat, HasSucceeded, newcomputername, oldcomputername);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1885,7 +1885,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Methods
|
||||
private OSProductSuite[] MakeProductSuites(uint? suiteMask)
|
||||
private static OSProductSuite[] MakeProductSuites(uint? suiteMask)
|
||||
{
|
||||
if (suiteMask == null)
|
||||
return null;
|
||||
|
||||
@@ -1578,7 +1578,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// <summary>
|
||||
/// Map the return code from 'AttachDebugger' to error message.
|
||||
/// </summary>
|
||||
private string MapReturnCodeToErrorMessage(int returnCode)
|
||||
private static string MapReturnCodeToErrorMessage(int returnCode)
|
||||
{
|
||||
string errorMessage = string.Empty;
|
||||
switch (returnCode)
|
||||
@@ -2106,7 +2106,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
return filepath;
|
||||
}
|
||||
|
||||
private void LoadEnvironmentVariable(ProcessStartInfo startinfo, IDictionary EnvironmentVariables)
|
||||
private static void LoadEnvironmentVariable(ProcessStartInfo startinfo, IDictionary EnvironmentVariables)
|
||||
{
|
||||
var processEnvironment = startinfo.EnvironmentVariables;
|
||||
foreach (DictionaryEntry entry in EnvironmentVariables)
|
||||
|
||||
@@ -1085,7 +1085,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// True if all dependent services are stopped
|
||||
/// False if not all dependent services are stopped
|
||||
/// </returns>
|
||||
private bool HaveAllDependentServicesStopped(ServiceController[] dependentServices)
|
||||
private static bool HaveAllDependentServicesStopped(ServiceController[] dependentServices)
|
||||
{
|
||||
return Array.TrueForAll(dependentServices, service => service.Status == ServiceControllerStatus.Stopped);
|
||||
}
|
||||
|
||||
+1
-1
@@ -793,7 +793,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
|
||||
// Users most often use the default buffer size so we cache the buffer.
|
||||
// Creates and fills a send buffer. This follows the ping.exe and CoreFX model.
|
||||
private byte[] GetSendBuffer(int bufferSize)
|
||||
private static byte[] GetSendBuffer(int bufferSize)
|
||||
{
|
||||
if (bufferSize == DefaultSendBufferSize && s_DefaultSendBuffer != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user