Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/Attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ public ValidateRangeAttribute(ValidateRangeKind kind) : base()
_rangeKind = kind;
}

private void ValidateRange(object element, ValidateRangeKind rangeKind)
private static void ValidateRange(object element, ValidateRangeKind rangeKind)
{
Type commonType = GetCommonType(typeof(int), element.GetType());
if (commonType == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,7 @@ private void IgnoreOtherMandatoryParameterSets(uint otherMandatorySetsToBeIgnore
}
}

private uint NewParameterSetPromptingData(
private static uint NewParameterSetPromptingData(
Dictionary<uint, ParameterSetPromptingData> promptingData,
MergedCompiledCommandParameter parameter,
ParameterSetSpecificMetadata parameterSetMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ internal List<CompletionResult> GetResultHelper(CompletionContext completionCont
}

// Helper method to auto complete hashtable key
private List<CompletionResult> GetResultForHashtable(CompletionContext completionContext)
private static List<CompletionResult> GetResultForHashtable(CompletionContext completionContext)
{
var lastAst = completionContext.RelatedAsts.Last();
HashtableAst tempHashtableAst = null;
Expand Down Expand Up @@ -986,7 +986,7 @@ private List<CompletionResult> GetResultForHashtable(CompletionContext completio
}

// Helper method to look for an incomplete assignment pair in hash table.
private bool CheckForPendingAssignment(HashtableAst hashTableAst)
private static bool CheckForPendingAssignment(HashtableAst hashTableAst)
{
foreach (var keyValue in hashTableAst.KeyValuePairs)
{
Expand Down Expand Up @@ -1054,7 +1054,7 @@ private static string GetFirstLineSubString(string stringToComplete, out bool ha
return stringToComplete;
}

private Tuple<ExpressionAst, StatementAst> GetHashEntryContainsCursor(
private static Tuple<ExpressionAst, StatementAst> GetHashEntryContainsCursor(
IScriptPosition cursor,
HashtableAst hashTableAst,
bool isCursorInString)
Expand Down Expand Up @@ -1345,7 +1345,7 @@ private static List<CompletionResult> GetResultForEnum(
return GetMatchedResults(allNames, completionContext);
}

private List<CompletionResult> GetResultForEnumPropertyValueOfDSCResource(
private static List<CompletionResult> GetResultForEnumPropertyValueOfDSCResource(
CompletionContext completionContext,
string stringToComplete,
ref int replacementIndex,
Expand Down Expand Up @@ -1632,7 +1632,7 @@ private List<CompletionResult> GetResultForString(CompletionContext completionCo
/// <param name="ast"></param>
/// <param name="keywordAst"></param>
/// <returns></returns>
private ConfigurationDefinitionAst GetAncestorConfigurationAstAndKeywordAst(
private static ConfigurationDefinitionAst GetAncestorConfigurationAstAndKeywordAst(
IScriptPosition cursorPosition,
Ast ast,
out DynamicKeywordStatementAst keywordAst)
Expand Down Expand Up @@ -1668,7 +1668,7 @@ private ConfigurationDefinitionAst GetAncestorConfigurationAstAndKeywordAst(
/// <param name="keywordAst"></param>
/// <param name="matched"></param>
/// <returns></returns>
private List<CompletionResult> GetResultForIdentifierInConfiguration(
private static List<CompletionResult> GetResultForIdentifierInConfiguration(
CompletionContext completionContext,
ConfigurationDefinitionAst configureAst,
DynamicKeywordStatementAst keywordAst,
Expand Down Expand Up @@ -2082,7 +2082,7 @@ private List<CompletionResult> GetResultForIdentifier(CompletionContext completi
return result;
}

private List<CompletionResult> GetResultForAttributeArgument(CompletionContext completionContext, ref int replacementIndex, ref int replacementLength)
private static List<CompletionResult> GetResultForAttributeArgument(CompletionContext completionContext, ref int replacementIndex, ref int replacementLength)
{
// Attribute member arguments
Type attributeType = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ internal CommandDiscovery(ExecutionContext context)
/// <returns>
/// True if the cmdlet is a special cmdlet that shouldn't be part of the discovery list. Or false otherwise.
/// </returns>
private bool IsSpecialCmdlet(Type implementingType)
private static bool IsSpecialCmdlet(Type implementingType)
{
// These commands should never be put in the discovery list. They are an internal implementation
// detail of the formatting and output component. That component uses these cmdlets by creating
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/CommandSearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ private static bool checkPath(string path, string commandName)
// Don't return commands to the user if that might result in:
// - Trusted commands calling untrusted functions that the user has overridden
// - Debug prompts calling internal functions that are likely to have code injection
private bool ShouldSkipCommandResolutionForConstrainedLanguage(CommandInfo? result, ExecutionContext executionContext)
private static bool ShouldSkipCommandResolutionForConstrainedLanguage(CommandInfo? result, ExecutionContext executionContext)
{
if (result == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ internal override bool ExistEnum(object enumVal)
return exist;
}

private bool isUnsigned(Type type)
private static bool isUnsigned(Type type)
{
return (type == typeof(ulong) || type == typeof(uint) || type == typeof(ushort) || type == typeof(byte));
}
Expand Down Expand Up @@ -385,7 +385,7 @@ internal bool ExistsInExpression(T flagName)
/// <returns>
/// A generic list of tokenized input.
/// </returns>
private List<Token> TokenizeInput(string input)
private static List<Token> TokenizeInput(string input)
{
List<Token> tokenList = new List<Token>();
int _offset = 0;
Expand All @@ -411,7 +411,7 @@ private List<Token> TokenizeInput(string input)
/// <param name="_offset">
/// Current offset position for the string parser.
/// </param>
private void FindNextToken(string input, ref int _offset)
private static void FindNextToken(string input, ref int _offset)
{
while (_offset < input.Length)
{
Expand All @@ -438,7 +438,7 @@ private void FindNextToken(string input, ref int _offset)
/// <returns>
/// The next token on the input string
/// </returns>
private Token GetNextToken(string input, ref int _offset)
private static Token GetNextToken(string input, ref int _offset)
{
StringBuilder sb = new StringBuilder();
// bool singleQuoted = false;
Expand Down Expand Up @@ -521,7 +521,7 @@ private Token GetNextToken(string input, ref int _offset)
/// <param name="tokenList">
/// A list of tokenized input.
/// </param>
private void CheckSyntaxError(List<Token> tokenList)
private static void CheckSyntaxError(List<Token> tokenList)
{
// Initialize, assuming preceded by OR
TokenKind previous = TokenKind.Or;
Expand Down Expand Up @@ -576,7 +576,7 @@ private void CheckSyntaxError(List<Token> tokenList)
/// <param name="tokenList">
/// Tokenized list of the input string.
/// </param>
private Node ConstructExpressionTree(List<Token> tokenList)
private static Node ConstructExpressionTree(List<Token> tokenList)
{
bool notFlag = false;
Queue<Node> andQueue = new Queue<Node>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2584,7 +2584,7 @@ HashSet<CommandInfo> GetPublicCommands()
return null;
}

private string[] GetModulesForUnResolvedCommands(IEnumerable<string> unresolvedCommands, ExecutionContext context)
private static string[] GetModulesForUnResolvedCommands(IEnumerable<string> unresolvedCommands, ExecutionContext context)
{
Collection<string> modulesToImport = new Collection<string>();
HashSet<string> commandsToResolve = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
Expand Down Expand Up @@ -3072,7 +3072,7 @@ private RunspaceOpenModuleLoadException ProcessModulesToImport(
/// <param name="moduleName"></param>
/// <param name="context"></param>
/// <returns></returns>
private IEnumerable<CommandInfo> LookupCommands(
private static IEnumerable<CommandInfo> LookupCommands(
string commandPattern,
string moduleName,
ExecutionContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public WMIParameterInformation(string name, Type ty) : base(ty, true, null, fals
/// <param name="dotnetBaseType"></param>
/// <param name="shouldIncludeNamespace"></param>
/// <returns></returns>
private IEnumerable<string> GetTypeNameHierarchyFromDerivation(ManagementBaseObject managementObj,
private static IEnumerable<string> GetTypeNameHierarchyFromDerivation(ManagementBaseObject managementObj,
string dotnetBaseType, bool shouldIncludeNamespace)
{
StringBuilder type = new StringBuilder(200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ PSObject outputObject in
}
}

private PSModuleInfo GetModuleInfoForRemoteModuleWithoutManifest(RemoteDiscoveryHelper.CimModule cimModule)
private static PSModuleInfo GetModuleInfoForRemoteModuleWithoutManifest(RemoteDiscoveryHelper.CimModule cimModule)
{
return new PSModuleInfo(cimModule.ModuleName, null, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ private static bool IsCmdletizationFile(RemoteDiscoveryHelper.CimModuleFile cimM
return cimModuleFile.FileCode == RemoteDiscoveryHelper.CimFileCode.CmdletizationV1;
}

private IEnumerable<string> CreateCimModuleFiles(
private static IEnumerable<string> CreateCimModuleFiles(
RemoteDiscoveryHelper.CimModule remoteCimModule,
RemoteDiscoveryHelper.CimFileCode fileCode,
Func<RemoteDiscoveryHelper.CimModuleFile, bool> filesFilter,
Expand Down Expand Up @@ -2068,7 +2068,7 @@ internal override IList<PSModuleInfo> ImportModulesUsingWinCompat(IEnumerable<st
return moduleProxyList;
}

private void SetModuleBaseForEngineModules(string moduleName, System.Management.Automation.ExecutionContext context)
private static void SetModuleBaseForEngineModules(string moduleName, System.Management.Automation.ExecutionContext context)
{
// Set modulebase of engine modules to point to $pshome
// This is so that Get-Help can load the correct help.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ private IEnumerable<PSModuleInfo> GetModuleForRootedPaths(List<string> modulePat
}
}

private ErrorRecord CreateModuleNotFoundError(string modulePath)
private static ErrorRecord CreateModuleNotFoundError(string modulePath)
{
string errorMessage = StringUtil.Format(Modules.ModuleNotFoundForGetModule, modulePath);
FileNotFoundException fnf = new FileNotFoundException(errorMessage);
Expand Down Expand Up @@ -1421,7 +1421,7 @@ private IEnumerable<PSModuleInfo> CreateFakeModuleObject(IEnumerable<ModuleSpeci
}
}

private ErrorRecord GetErrorRecordIfUnsupportedRootCdxmlAndNestedModuleScenario(
private static ErrorRecord GetErrorRecordIfUnsupportedRootCdxmlAndNestedModuleScenario(
Hashtable data,
string moduleManifestPath,
string rootModulePath)
Expand Down Expand Up @@ -4203,7 +4203,7 @@ private static bool HasRequiredModulesCyclicReference(ModuleSpecification curren
/// Search for a localized psd1 manifest file, using the same algorithm
/// as Import-LocalizedData.
/// </summary>
private ExternalScriptInfo FindLocalizedModuleManifest(string path)
private static ExternalScriptInfo FindLocalizedModuleManifest(string path)
{
string dir = Path.GetDirectoryName(path);
string file = Path.GetFileName(path);
Expand Down Expand Up @@ -4435,7 +4435,7 @@ internal void SetModuleLoggingInformation(PSModuleInfo m)
}
}

private void SetModuleLoggingInformation(ModuleLoggingGroupPolicyStatus status, PSModuleInfo m, IEnumerable<string> moduleNames)
private static void SetModuleLoggingInformation(ModuleLoggingGroupPolicyStatus status, PSModuleInfo m, IEnumerable<string> moduleNames)
{
// TODO, insivara : What happens when Enabled but none of the other options (DefaultSystemModules, NonDefaultSystemModule, NonSystemModule, SpecificModules) are set?
// After input from GP team for this behavior, need to revisit the commented out part
Expand Down Expand Up @@ -6073,7 +6073,7 @@ private static bool ShouldProcessScriptModule(PSModuleInfo parentModule, ref boo

private static readonly object s_lockObject = new object();

private void ClearAnalysisCaches()
private static void ClearAnalysisCaches()
{
lock (s_lockObject)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public string DefaultCommandPrefix
/// </summary>
/// <param name="name">The string to quote.</param>
/// <returns>The quoted string.</returns>
private string QuoteName(string name)
private static string QuoteName(string name)
{
if (name == null)
return "''";
Expand All @@ -546,7 +546,7 @@ private string QuoteName(string name)
/// </summary>
/// <param name="name">The Uri to quote.</param>
/// <returns>The quoted AbsoluteUri.</returns>
private string QuoteName(Uri name)
private static string QuoteName(Uri name)
{
if (name == null)
return "''";
Expand All @@ -558,7 +558,7 @@ private string QuoteName(Uri name)
/// </summary>
/// <param name="name">The Version object to quote.</param>
/// <returns>The quoted Version string.</returns>
private string QuoteName(Version name)
private static string QuoteName(Version name)
{
if (name == null)
return "''";
Expand All @@ -572,7 +572,7 @@ private string QuoteName(Version name)
/// <param name="names">The list to quote.</param>
/// <param name="streamWriter">Streamwriter to get end of line character from.</param>
/// <returns>The quoted list.</returns>
private string QuoteNames(IEnumerable names, StreamWriter streamWriter)
private static string QuoteNames(IEnumerable names, StreamWriter streamWriter)
{
if (names == null)
return "@()";
Expand Down Expand Up @@ -622,7 +622,7 @@ private string QuoteNames(IEnumerable names, StreamWriter streamWriter)
/// </summary>
/// <param name="moduleSpecs"></param>
/// <returns></returns>
private IEnumerable PreProcessModuleSpec(IEnumerable moduleSpecs)
private static IEnumerable PreProcessModuleSpec(IEnumerable moduleSpecs)
{
if (moduleSpecs != null)
{
Expand All @@ -647,7 +647,7 @@ private IEnumerable PreProcessModuleSpec(IEnumerable moduleSpecs)
/// <param name="moduleSpecs">The list to quote.</param>
/// <param name="streamWriter">Streamwriter to get end of line character from.</param>
/// <returns>The quoted list.</returns>
private string QuoteModules(IEnumerable moduleSpecs, StreamWriter streamWriter)
private static string QuoteModules(IEnumerable moduleSpecs, StreamWriter streamWriter)
{
StringBuilder result = new StringBuilder();
result.Append("@(");
Expand Down Expand Up @@ -897,7 +897,7 @@ private string ManifestFragmentForNonSpecifiedManifestMember(string key, string
_indent, resourceString, streamWriter.NewLine, key, value);
}

private string ManifestComment(string insert, StreamWriter streamWriter)
private static string ManifestComment(string insert, StreamWriter streamWriter)
{
// Prefix a non-empty string with a space for formatting reasons...
if (!string.IsNullOrEmpty(insert))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ public Dictionary<string, FunctionInfo> ExportedFunctions
}
}

private bool IsScriptModuleFile(string path)
private static bool IsScriptModuleFile(string path)
{
var ext = System.IO.Path.GetExtension(path);
return ext != null && s_scriptModuleExtensions.Contains(ext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ private void ProcessCmdletArguments(object value, Action<string> onEachArgument)
//
// It also only populates the bound parameters for a limited set of parameters needed
// for module analysis.
private Hashtable DoPsuedoParameterBinding(CommandAst commandAst, string commandName)
private static Hashtable DoPsuedoParameterBinding(CommandAst commandAst, string commandName)
{
var result = new Hashtable(StringComparer.OrdinalIgnoreCase);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ private bool IsValidFilePath(string path, PSModuleInfo module, bool verifyPathSc
/// </summary>
/// <param name="assemblyName"></param>
/// <returns></returns>
private bool IsValidGacAssembly(string assemblyName)
private static bool IsValidGacAssembly(string assemblyName)
{
#if UNIX
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ private ProcessStartInfo GetProcessStartInfo(bool redirectOutput, bool redirectE
return startInfo;
}

private bool IsDownstreamOutDefault(Pipe downstreamPipe)
private static bool IsDownstreamOutDefault(Pipe downstreamPipe)
{
Diagnostics.Assert(downstreamPipe != null, "Caller makes sure the passed-in parameter is not null.");

Expand Down Expand Up @@ -1316,6 +1316,10 @@ private void CalculateIORedirection(bool isWindowsApplication, out bool redirect

// On Windows, check the extension list and see if we should try to execute this directly.
// Otherwise, use the platform library to check executability
[SuppressMessage(
"Performance",
"CA1822:Mark members as static",
Justification = "Accesses instance members in preprocessor branch.")]
private bool IsExecutable(string path)
{
#if UNIX
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/PSClassSearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ private Collection<PSModuleInfo> GetPSModuleInfo(string modulePath)
return modules;
}

private PSClassInfo ConvertToClassInfo(PSModuleInfo module, ScriptBlockAst ast, TypeDefinitionAst statement)
private static PSClassInfo ConvertToClassInfo(PSModuleInfo module, ScriptBlockAst ast, TypeDefinitionAst statement)
{
PSClassInfo classInfo = new PSClassInfo(statement.Name);
Dbg.Assert(statement.Name != null, "statement should have a name.");
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/PSConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ internal void SetExecutionPolicy(ConfigScope scope, string shellId, string execu
WriteValueToFile<string>(scope, key, executionPolicy);
}

private string GetExecutionPolicySettingKey(string shellId)
private static string GetExecutionPolicySettingKey(string shellId)
{
return string.Equals(shellId, Utils.DefaultPowerShellShellID, StringComparison.Ordinal)
? ExecutionPolicyDefaultShellKey
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/Pipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ internal void SetVariableListForTemporaryPipe(Pipe tempPipe)
CopyVariableToTempPipe(VariableStreamKind.Information, _informationVariableList, tempPipe);
}

private void CopyVariableToTempPipe(VariableStreamKind streamKind, List<IList> variableList, Pipe tempPipe)
private static void CopyVariableToTempPipe(VariableStreamKind streamKind, List<IList> variableList, Pipe tempPipe)
{
if (variableList != null && variableList.Count > 0)
{
Expand Down
Loading