From 8978a8eea83f348d61a34675318c6310ee0426bf Mon Sep 17 00:00:00 2001 From: xtqqczze Date: Thu, 12 Nov 2020 01:59:02 +0000 Subject: [PATCH] Enable IDE0062: MakeLocalFunctionStatic 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 32bea9725fd..b7b03ac20a5 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 ce634d92c71..a7514976fa3 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs @@ -1073,7 +1073,7 @@ private void ParseExecutionPolicy(string[] args, ref int i, ref string? executio 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 8d1509352cb..69202e6d20e 100644 --- a/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs +++ b/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs @@ -51,7 +51,7 @@ internal string FullName { 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 f34ee0811ed..b654ab0ccdc 100644 --- a/src/System.Management.Automation/engine/parser/ast.cs +++ b/src/System.Management.Automation/engine/parser/ast.cs @@ -1414,7 +1414,7 @@ IEnumerable IParameterMetadataProvider.GetExperimentalAtt } } - ExperimentalAttribute GetExpAttributeHelper(AttributeAst attributeAst) + static ExperimentalAttribute GetExpAttributeHelper(AttributeAst attributeAst) { AttributeAst potentialExpAttr = null; string expAttrTypeName = typeof(ExperimentalAttribute).FullName;