From 1dc0ba4a69e6766cdc40b6863c8a9bf56ac3904c Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Fri, 13 Nov 2020 04:12:38 +0000 Subject: [PATCH] Enable IDE0062: MakeLocalFunctionStatic (#14044) https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0062 --- .globalconfig | 2 +- .../host/msh/CommandLineParameterParser.cs | 2 +- .../engine/DataStoreAdapterProvider.cs | 2 +- src/System.Management.Automation/engine/parser/ast.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.globalconfig b/.globalconfig index 3ae80835a2..c22cb5a96c 100644 --- a/.globalconfig +++ b/.globalconfig @@ -911,7 +911,7 @@ dotnet_diagnostic.IDE0060.severity = silent dotnet_diagnostic.IDE0061.severity = silent # IDE0062: MakeLocalFunctionStatic -dotnet_diagnostic.IDE0062.severity = silent +dotnet_diagnostic.IDE0062.severity = warning # IDE0063: UseSimpleUsingStatement dotnet_diagnostic.IDE0063.severity = silent diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs index ce634d92c7..a7514976fa 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs @@ -1073,7 +1073,7 @@ namespace Microsoft.PowerShell private bool ParseFile(string[] args, ref int i, bool noexitSeen) { // Try parse '$true', 'true', '$false' and 'false' values. - object ConvertToBoolIfPossible(string arg) + static object ConvertToBoolIfPossible(string arg) { // Before parsing we skip '$' if present. return arg.Length > 0 && bool.TryParse(arg.AsSpan().Slice(arg[0] == '$' ? 1 : 0), out bool boolValue) diff --git a/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs b/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs index 8d1509352c..69202e6d20 100644 --- a/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs +++ b/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs @@ -51,7 +51,7 @@ namespace System.Management.Automation { get { - string GetFullName(string name, string psSnapInName, string moduleName) + static string GetFullName(string name, string psSnapInName, string moduleName) { string result = name; if (!string.IsNullOrEmpty(psSnapInName)) diff --git a/src/System.Management.Automation/engine/parser/ast.cs b/src/System.Management.Automation/engine/parser/ast.cs index f34ee0811e..b654ab0ccd 100644 --- a/src/System.Management.Automation/engine/parser/ast.cs +++ b/src/System.Management.Automation/engine/parser/ast.cs @@ -1414,7 +1414,7 @@ namespace System.Management.Automation.Language } } - ExperimentalAttribute GetExpAttributeHelper(AttributeAst attributeAst) + static ExperimentalAttribute GetExpAttributeHelper(AttributeAst attributeAst) { AttributeAst potentialExpAttr = null; string expAttrTypeName = typeof(ExperimentalAttribute).FullName;