mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix CA1822: Mark members as static part 5 (#14228)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822
This commit is contained in:
@@ -224,7 +224,7 @@ namespace Microsoft.PowerShell
|
||||
throw hostException;
|
||||
}
|
||||
|
||||
if (s_theConsoleHost.LoadPSReadline())
|
||||
if (LoadPSReadline())
|
||||
{
|
||||
ProfileOptimization.StartProfile("StartupProfileData-Interactive");
|
||||
|
||||
@@ -1156,6 +1156,10 @@ namespace Microsoft.PowerShell
|
||||
AppDomain.CurrentDomain.UnhandledException += handler;
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage(
|
||||
"Performance",
|
||||
"CA1822:Mark members as static",
|
||||
Justification = "Accesses instance members in preprocessor branch.")]
|
||||
private void BindBreakHandler()
|
||||
{
|
||||
#if UNIX
|
||||
@@ -1598,7 +1602,7 @@ namespace Microsoft.PowerShell
|
||||
return _screenReaderActive.Value;
|
||||
}
|
||||
|
||||
private bool LoadPSReadline()
|
||||
private static bool LoadPSReadline()
|
||||
{
|
||||
// Don't load PSReadline if:
|
||||
// * we don't think the process will be interactive, e.g. -command or -file
|
||||
@@ -1706,7 +1710,7 @@ namespace Microsoft.PowerShell
|
||||
DoRunspaceInitialization(skipProfiles, initialCommand, configurationName, initialCommandArgs);
|
||||
}
|
||||
|
||||
private void OpenConsoleRunspace(Runspace runspace, bool staMode)
|
||||
private static void OpenConsoleRunspace(Runspace runspace, bool staMode)
|
||||
{
|
||||
if (staMode && Platform.IsWindowsDesktop)
|
||||
{
|
||||
@@ -2726,7 +2730,7 @@ namespace Microsoft.PowerShell
|
||||
return results ?? new DebuggerCommandResults(DebuggerResumeAction.Continue, false);
|
||||
}
|
||||
|
||||
private bool IsIncompleteParseException(Exception e)
|
||||
private static bool IsIncompleteParseException(Exception e)
|
||||
{
|
||||
// Check e's type.
|
||||
if (e is IncompleteParseException)
|
||||
|
||||
@@ -548,7 +548,7 @@ namespace Microsoft.PowerShell
|
||||
/// Helper method to create and trace PipelineStoppedException.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private PipelineStoppedException NewPipelineStoppedException()
|
||||
private static PipelineStoppedException NewPipelineStoppedException()
|
||||
{
|
||||
PipelineStoppedException e = new PipelineStoppedException();
|
||||
return e;
|
||||
|
||||
@@ -619,7 +619,7 @@ namespace Microsoft.PowerShell
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ConsoleOutWriteHelper(ReadOnlySpan<char> value, bool newLine)
|
||||
private static void ConsoleOutWriteHelper(ReadOnlySpan<char> value, bool newLine)
|
||||
{
|
||||
if (newLine)
|
||||
{
|
||||
@@ -1847,7 +1847,7 @@ namespace Microsoft.PowerShell
|
||||
/// </summary>
|
||||
/// <param name="input">The string to process.</param>
|
||||
/// <returns>The string with any \0 characters removed...</returns>
|
||||
private string RemoveNulls(string input)
|
||||
private static string RemoveNulls(string input)
|
||||
{
|
||||
if (input.Contains('\0'))
|
||||
{
|
||||
@@ -2042,7 +2042,7 @@ namespace Microsoft.PowerShell
|
||||
}
|
||||
|
||||
#if !UNIX
|
||||
private void SendLeftArrows(int length)
|
||||
private static void SendLeftArrows(int length)
|
||||
{
|
||||
var inputs = new ConsoleControl.INPUT[length * 2];
|
||||
for (int i = 0; i < length; i++)
|
||||
|
||||
@@ -342,7 +342,7 @@ namespace Microsoft.PowerShell
|
||||
return ExecuteCommandHelper(tempPipeline, out exceptionThrown, options);
|
||||
}
|
||||
|
||||
private Command GetOutDefaultCommand(bool endOfStatement)
|
||||
private static Command GetOutDefaultCommand(bool endOfStatement)
|
||||
{
|
||||
return new Command(command: "Out-Default",
|
||||
isScript: false,
|
||||
|
||||
@@ -298,6 +298,10 @@ namespace Microsoft.PowerShell
|
||||
private int _oldestSoFar;
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage(
|
||||
"Performance",
|
||||
"CA1822:Mark members as static",
|
||||
Justification = "Accesses instance members in preprocessor branch.")]
|
||||
private
|
||||
ProgressNode
|
||||
FindOldestLeafmostNodeHelper(ArrayList treeToSearch, out ArrayList listWhereFound, out int indexWhereFound)
|
||||
|
||||
Reference in New Issue
Block a user