diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs index e1b06c0bc9..126596818a 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs @@ -533,7 +533,10 @@ $result { try { - if (token.IsCancellationRequested) { break; } + if (token.IsCancellationRequested) + { + break; + } using (CimSession cimSession = RemoteDiscoveryHelper.CreateCimSession(computer, Credential, WsmanAuthentication, isLocalHost: false, this, token)) { @@ -675,7 +678,10 @@ $result { try { - if (token.IsCancellationRequested) { break; } + if (token.IsCancellationRequested) + { + break; + } using (CimSession cimSession = RemoteDiscoveryHelper.CreateCimSession(computer, credential, wsmanAuthentication, isLocalHost: false, cmdlet, token)) { @@ -830,7 +836,10 @@ $result ValidateComputerNames(); object[] flags = new object[] { 2, 0 }; - if (Force) flags[0] = forcedReboot; + if (Force) + { + flags[0] = forcedReboot; + } if (ParameterSetName.Equals(DefaultParameterSet, StringComparison.OrdinalIgnoreCase)) { @@ -905,14 +914,18 @@ $result while (true) { - int loopCount = actualDelay * 4; // (delay * 1000)/250ms + // (delay * 1000)/250ms + int loopCount = actualDelay * 4; while (loopCount > 0) { WriteProgress(_indicator[(indicatorIndex++) % 4] + _activity, _status, _percent, ProgressRecordType.Processing); loopCount--; _waitHandler.Wait(250); - if (_exit) { break; } + if (_exit) + { + break; + } } if (first) @@ -932,7 +945,10 @@ $result // Test restart stage. // We check if the target machine has already rebooted by querying the LastBootUpTime from the Win32_OperatingSystem object. // So after this step, we are sure that both the Network and the WMI or WinRM service have already come up. - if (_exit) { break; } + if (_exit) + { + break; + } if (restartStageTestList.Count > 0) { @@ -948,7 +964,10 @@ $result } // Test WMI service - if (_exit) { break; } + if (_exit) + { + break; + } if (wmiTestList.Count > 0) { @@ -966,10 +985,16 @@ $result } } - if (isForWmi) { break; } + if (isForWmi) + { + break; + } // Test WinRM service - if (_exit) { break; } + if (_exit) + { + break; + } if (winrmTestList.Count > 0) { @@ -994,16 +1019,25 @@ $result loopCount--; _waitHandler.Wait(250); - if (_exit) { break; } + if (_exit) + { + break; + } } } } } - if (isForWinRm) { break; } + if (isForWinRm) + { + break; + } // Test PowerShell - if (_exit) { break; } + if (_exit) + { + break; + } if (psTestList.Count > 0) { @@ -1019,7 +1053,10 @@ $result } while (false); // if time is up or Ctrl+c is typed, break out - if (_exit) { break; } + if (_exit) + { + break; + } // Check if the restart completes switch (_waitFor) @@ -1063,18 +1100,38 @@ $result // The timeout expires. Write out timeout error messages for the computers that haven't finished restarting do { - if (restartStageTestList.Count > 0) { WriteOutTimeoutError(restartStageTestList); } + if (restartStageTestList.Count > 0) + { + WriteOutTimeoutError(restartStageTestList); + } + + if (wmiTestList.Count > 0) + { + WriteOutTimeoutError(wmiTestList); + } - if (wmiTestList.Count > 0) { WriteOutTimeoutError(wmiTestList); } // Wait for WMI. All computers that finished restarting are put in "winrmTestList" - if (isForWmi) { break; } + if (isForWmi) + { + break; + } // Wait for WinRM. All computers that finished restarting are put in "psTestList" - if (winrmTestList.Count > 0) { WriteOutTimeoutError(winrmTestList); } + if (winrmTestList.Count > 0) + { + WriteOutTimeoutError(winrmTestList); + } - if (isForWinRm) { break; } + if (isForWinRm) + { + break; + } + + if (psTestList.Count > 0) + { + WriteOutTimeoutError(psTestList); + } - if (psTestList.Count > 0) { WriteOutTimeoutError(psTestList); } // Wait for PowerShell. All computers that finished restarting are put in "allDoneList" } while (false); } @@ -1221,7 +1278,10 @@ $result string strLocal = string.Empty; bool isLocalHost = false; - if (_cancel.Token.IsCancellationRequested) { break; } + if (_cancel.Token.IsCancellationRequested) + { + break; + } if ((computer.Equals("localhost", StringComparison.OrdinalIgnoreCase)) || (computer.Equals(".", StringComparison.OrdinalIgnoreCase))) { @@ -1576,7 +1636,10 @@ $result protected override void ProcessRecord() { string targetComputer = ValidateComputerName(); - if (targetComputer == null) return; + if (targetComputer == null) + { + return; + } bool isLocalhost = targetComputer.Equals("localhost", StringComparison.OrdinalIgnoreCase); if (isLocalhost) @@ -1596,7 +1659,10 @@ $result /// protected override void EndProcessing() { - if (!_containsLocalHost) return; + if (!_containsLocalHost) + { + return; + } DoRenameComputerAction("localhost", _newNameForLocalHost, true); } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs index 89c58acbf5..4732716841 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs @@ -360,7 +360,11 @@ namespace Microsoft.PowerShell.Commands } catch (InvalidOperationException e) { - if (processing) throw; + if (processing) + { + throw; + } + ThrowTerminatingError(new ErrorRecord( e, // default exception text is OK "EventLogNotFound", @@ -490,7 +494,10 @@ namespace Microsoft.PowerShell.Commands } } - if (!entrymatch) return entrymatch; + if (!entrymatch) + { + return entrymatch; + } } if (_sources != null) @@ -511,7 +518,10 @@ namespace Microsoft.PowerShell.Commands } } - if (!sourcematch) return sourcematch; + if (!sourcematch) + { + return sourcematch; + } } if (_message != null) @@ -545,7 +555,10 @@ namespace Microsoft.PowerShell.Commands } } - if (!usernamematch) return usernamematch; + if (!usernamematch) + { + return usernamematch; + } } if (_isDateSpecified) @@ -582,7 +595,10 @@ namespace Microsoft.PowerShell.Commands } } - if (!datematch) return datematch; + if (!datematch) + { + return datematch; + } } return true; diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs index 547b121c57..3fc313fe22 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs @@ -475,7 +475,10 @@ namespace Microsoft.PowerShell.Commands break; } - if (proxyType != null) break; + if (proxyType != null) + { + break; + } } System.Management.Automation.Diagnostics.Assert( diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddMember.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddMember.cs index efb035b778..8ddd95e6b8 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddMember.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddMember.cs @@ -524,7 +524,10 @@ namespace Microsoft.PowerShell.Commands // Respect the type shortcut Type type; string typeNameInUse = _typeName; - if (LanguagePrimitives.TryConvertTo(_typeName, out type)) { typeNameInUse = type.FullName; } + if (LanguagePrimitives.TryConvertTo(_typeName, out type)) + { + typeNameInUse = type.FullName; + } _inputObject.TypeNames.Insert(0, typeNameInUse); } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs index bc1d6b0ba4..926d6c3dc1 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs @@ -301,7 +301,10 @@ namespace Microsoft.PowerShell.Commands set { - if (value != null) { _referencedAssemblies = value; } + if (value != null) + { + _referencedAssemblies = value; + } } } @@ -867,7 +870,10 @@ namespace Microsoft.PowerShell.Commands var tempReferences = new List(s_autoReferencedAssemblies.Value); foreach (string assembly in ReferencedAssemblies) { - if (string.IsNullOrWhiteSpace(assembly)) { continue; } + if (string.IsNullOrWhiteSpace(assembly)) + { + continue; + } string resolvedAssemblyPath = ResolveAssemblyName(assembly, true); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/DebugRunspaceCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/DebugRunspaceCommand.cs index fc257810d5..579522a6d3 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/DebugRunspaceCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/DebugRunspaceCommand.cs @@ -270,7 +270,10 @@ namespace Microsoft.PowerShell.Commands // Wait for running script. _newRunningScriptEvent.Wait(); - if (!_debugging) { return; } + if (!_debugging) + { + return; + } AddDataEventHandlers(); @@ -503,7 +506,10 @@ namespace Microsoft.PowerShell.Commands private void AddToDebugBlockingCollection(PSStreamObject streamItem) { - if (!_debugBlockingCollection.IsOpen) { return; } + if (!_debugBlockingCollection.IsOpen) + { + return; + } if (streamItem != null) { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/EnableDisableRunspaceDebugCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/EnableDisableRunspaceDebugCommand.cs index e4d5b5d6b2..fdc2911fa6 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/EnableDisableRunspaceDebugCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/EnableDisableRunspaceDebugCommand.cs @@ -59,7 +59,10 @@ namespace Microsoft.PowerShell.Commands /// Runspace local Id. public PSRunspaceDebug(bool enabled, bool breakAll, string runspaceName, int runspaceId) { - if (string.IsNullOrEmpty(runspaceName)) { throw new PSArgumentNullException(nameof(runspaceName)); } + if (string.IsNullOrEmpty(runspaceName)) + { + throw new PSArgumentNullException(nameof(runspaceName)); + } this.Enabled = enabled; this.BreakAll = breakAll; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewEventCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewEventCommand.cs index 34c95a116f..1e46241b2d 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewEventCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewEventCommand.cs @@ -121,7 +121,10 @@ namespace Microsoft.PowerShell.Commands } object messageSender = null; - if (_sender != null) { messageSender = _sender.BaseObject; } + if (_sender != null) + { + messageSender = _sender.BaseObject; + } // And then generate the event WriteObject(Events.GenerateEvent(_sourceIdentifier, messageSender, baseEventArgs, _messageData, true, false)); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Select-Object.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Select-Object.cs index d7ce5310c9..b54873067e 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Select-Object.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Select-Object.cs @@ -434,7 +434,11 @@ namespace Microsoft.PowerShell.Commands if (_exclusionFilter == null || !_exclusionFilter.IsMatch(resolvedName)) { List tempExprResults = resolvedName.GetValues(inputObject); - if (tempExprResults == null) continue; + if (tempExprResults == null) + { + continue; + } + foreach (PSPropertyExpressionResult mshExpRes in tempExprResults) { expressionResults.Add(mshExpRes); @@ -525,7 +529,10 @@ namespace Microsoft.PowerShell.Commands if (r.Exception == null) { // ignore the property value if it's null - if (r.Result == null) { return; } + if (r.Result == null) + { + return; + } System.Collections.IEnumerable results = LanguagePrimitives.GetEnumerable(r.Result); if (results == null) @@ -545,7 +552,10 @@ namespace Microsoft.PowerShell.Commands foreach (object expandedValue in results) { // ignore the element if it's null - if (expandedValue == null) { continue; } + if (expandedValue == null) + { + continue; + } // add NoteProperties if there is any // If expandedValue is a base object, we don't want to associate the NoteProperty diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs index 8e07a80384..675df27418 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs @@ -1117,7 +1117,10 @@ namespace Microsoft.PowerShell.Commands string removeFileTarget = UpdateDataStrings.UpdateTarget; Collection typeFileTotal = UpdateData.Glob(_typeFiles, "TypePathException", this); - if (typeFileTotal.Count == 0) { return; } + if (typeFileTotal.Count == 0) + { + return; + } // Key of the map is the name of the file that is in the cache. Value of the map is a index list. Duplicate files might // exist in the cache because the user can add arbitrary files to the cache by $host.Runspace.InitialSessionState.Types.Add() @@ -1129,7 +1132,10 @@ namespace Microsoft.PowerShell.Commands for (int index = 0; index < Context.InitialSessionState.Types.Count; index++) { string fileName = Context.InitialSessionState.Types[index].FileName; - if (fileName == null) { continue; } + if (fileName == null) + { + continue; + } // Resolving the file path because the path to the types file in module manifest is now specified as // ..\..\types.ps1xml which expands to C:\Windows\System32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Core\..\..\types.ps1xml diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs index 8873676c61..0cd748c613 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs @@ -208,7 +208,10 @@ namespace Microsoft.PowerShell.Commands { Dbg.Assert(Path != null, "FileName is mandatory parameter"); - if (!ShouldProcess(Path)) return; + if (!ShouldProcess(Path)) + { + return; + } StreamWriter sw; PathUtils.MasterStreamOpen( diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs index 1ab19d41c3..cddaac5fbd 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs @@ -1491,7 +1491,10 @@ namespace Microsoft.PowerShell result = ReadLineResult.endedOnEnter; // If the test hook is set, read from it. - if (s_h != null) return s_h.ReadLine(); + if (s_h != null) + { + return s_h.ReadLine(); + } string restOfLine = null; @@ -1536,14 +1539,21 @@ namespace Microsoft.PowerShell } var c = unchecked((char)inC); - if (!NoPrompt) Console.Out.Write(c); + if (!NoPrompt) + { + Console.Out.Write(c); + } if (c == '\r') { // Treat as newline, but consume \n if there is one. if (consoleIn.Peek() == '\n') { - if (!NoPrompt) Console.Out.Write('\n'); + if (!NoPrompt) + { + Console.Out.Write('\n'); + } + consoleIn.Read(); } diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs index d283a5dd29..af32014ab9 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs @@ -131,7 +131,10 @@ namespace System.Diagnostics.Eventing // // check if the object has been already disposed // - if (_disposed == 1) return; + if (_disposed == 1) + { + return; + } if (Interlocked.Exchange(ref _disposed, 1) != 0) { diff --git a/src/Microsoft.PowerShell.ScheduledJob/ScheduledJob.cs b/src/Microsoft.PowerShell.ScheduledJob/ScheduledJob.cs index 85680da94a..59403d8852 100644 --- a/src/Microsoft.PowerShell.ScheduledJob/ScheduledJob.cs +++ b/src/Microsoft.PowerShell.ScheduledJob/ScheduledJob.cs @@ -926,7 +926,10 @@ namespace Microsoft.PowerShell.ScheduledJob private void AddSetShouldExitToHost() { - if (!_allowSetShouldExit || _host == null) { return; } + if (!_allowSetShouldExit || _host == null) + { + return; + } PSObject hostPrivateData = _host.PrivateData as PSObject; if (hostPrivateData != null) @@ -938,7 +941,10 @@ namespace Microsoft.PowerShell.ScheduledJob private void RemoveSetShouldExitFromHost() { - if (!_allowSetShouldExit || _host == null) { return; } + if (!_allowSetShouldExit || _host == null) + { + return; + } PSObject hostPrivateData = _host.PrivateData as PSObject; if (hostPrivateData != null) diff --git a/src/Microsoft.WSMan.Management/ConfigProvider.cs b/src/Microsoft.WSMan.Management/ConfigProvider.cs index a5d9d6a7cb..701e6db510 100644 --- a/src/Microsoft.WSMan.Management/ConfigProvider.cs +++ b/src/Microsoft.WSMan.Management/ConfigProvider.cs @@ -617,7 +617,10 @@ namespace Microsoft.WSMan.Management SessionObjCache.TryGetValue(host, out sessionobj); XmlDocument xmlResource = FindResourceValue(sessionobj, uri, null); - if (xmlResource == null) { return; } + if (xmlResource == null) + { + return; + } // if endswith '\', removes it. if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 81b0e624dd..25b1624c6c 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -69,7 +69,10 @@ namespace System.Management.Automation #if UNIX return false; #else - if (_isNanoServer.HasValue) { return _isNanoServer.Value; } + if (_isNanoServer.HasValue) + { + return _isNanoServer.Value; + } _isNanoServer = false; using (RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Server\ServerLevels")) @@ -99,7 +102,10 @@ namespace System.Management.Automation #if UNIX return false; #else - if (_isIoT.HasValue) { return _isIoT.Value; } + if (_isIoT.HasValue) + { + return _isIoT.Value; + } _isIoT = false; using (RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion")) @@ -129,7 +135,10 @@ namespace System.Management.Automation #if UNIX return false; #else - if (_isWindowsDesktop.HasValue) { return _isWindowsDesktop.Value; } + if (_isWindowsDesktop.HasValue) + { + return _isWindowsDesktop.Value; + } _isWindowsDesktop = !IsNanoServer && !IsIoT; return _isWindowsDesktop.Value; diff --git a/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs b/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs index a0e0969470..ccc95b9735 100644 --- a/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs +++ b/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs @@ -1202,7 +1202,11 @@ function __cmdletization_BindCommonParameters MultiplyParameterSets( GetMethodParameterSet(method), StaticMethodParameterSetTemplate, commonParameterSets)) { - if (!firstParameterSet) output.Write(", "); + if (!firstParameterSet) + { + output.Write(", "); + } + firstParameterSet = false; output.Write("'{0}'", CodeGeneration.EscapeSingleQuotedStringContent(parameterSetName)); } @@ -1353,7 +1357,11 @@ function __cmdletization_BindCommonParameters bool firstParameterSet = true; foreach (string parameterSetName in MultiplyParameterSets(GetMethodParameterSet(method), InstanceMethodParameterSetTemplate, commonParameterSets, queryParameterSets)) { - if (!firstParameterSet) output.Write(", "); + if (!firstParameterSet) + { + output.Write(", "); + } + firstParameterSet = false; output.Write("'{0}'", CodeGeneration.EscapeSingleQuotedStringContent(parameterSetName)); } @@ -1495,7 +1503,11 @@ function __cmdletization_BindCommonParameters foreach (string queryParameterSetName in cmdletParameterMetadata.ParameterSets.Keys) foreach (string parameterSetName in MultiplyParameterSets(queryParameterSetName, InstanceQueryParameterSetTemplate, commonParameterSets, methodParameterSets)) { - if (!firstParameterSet) output.Write(", "); + if (!firstParameterSet) + { + output.Write(", "); + } + firstParameterSet = false; output.Write("'{0}'", CodeGeneration.EscapeSingleQuotedStringContent(parameterSetName)); } diff --git a/src/System.Management.Automation/engine/Attributes.cs b/src/System.Management.Automation/engine/Attributes.cs index 0e11dc7aac..e7b289418f 100644 --- a/src/System.Management.Automation/engine/Attributes.cs +++ b/src/System.Management.Automation/engine/Attributes.cs @@ -2053,7 +2053,10 @@ namespace System.Management.Automation { // If the element of the collection is of value type, then no need to check for null // because a value-type value cannot be null. - if (isElementValueType) { return; } + if (isElementValueType) + { + return; + } IEnumerator enumerator = LanguagePrimitives.GetEnumerator(arguments); while (enumerator.MoveNext()) @@ -2137,7 +2140,10 @@ namespace System.Management.Automation { bool isEmpty = true; IEnumerator enumerator = LanguagePrimitives.GetEnumerator(arguments); - if (enumerator.MoveNext()) { isEmpty = false; } + if (enumerator.MoveNext()) + { + isEmpty = false; + } // If the element of the collection is of value type, then no need to check for null // because a value-type value cannot be null. diff --git a/src/System.Management.Automation/engine/ExternalScriptInfo.cs b/src/System.Management.Automation/engine/ExternalScriptInfo.cs index 52713edb87..31a520d607 100644 --- a/src/System.Management.Automation/engine/ExternalScriptInfo.cs +++ b/src/System.Management.Automation/engine/ExternalScriptInfo.cs @@ -188,7 +188,10 @@ namespace System.Management.Automation { get { - if (Context == null) return SessionStateEntryVisibility.Public; + if (Context == null) + { + return SessionStateEntryVisibility.Public; + } return Context.EngineSessionState.CheckScriptVisibility(_path); } diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index 23383826ba..4cf2bc44e3 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -5231,7 +5231,11 @@ end { // the users of the cmdlet, instead of the author, should have control of what options applied to an alias // ('ScopedItemOptions.ReadOnly' and/or 'ScopedItemOptions.AllScopes'). var aliasEntry = new SessionStateAliasEntry(alias, cmdletName, description: string.Empty, ScopedItemOptions.None); - if (psSnapInInfo != null) { aliasEntry.SetPSSnapIn(psSnapInInfo); } + + if (psSnapInInfo != null) + { + aliasEntry.SetPSSnapIn(psSnapInInfo); + } if (moduleInfo != null) { diff --git a/src/System.Management.Automation/engine/InternalCommands.cs b/src/System.Management.Automation/engine/InternalCommands.cs index 0edc1a21a6..4f13089811 100644 --- a/src/System.Management.Automation/engine/InternalCommands.cs +++ b/src/System.Management.Automation/engine/InternalCommands.cs @@ -685,7 +685,10 @@ namespace Microsoft.PowerShell.Commands else { // if inputObject is of IDictionary, get the value - if (GetValueFromIDictionaryInput()) { return; } + if (GetValueFromIDictionaryInput()) + { + return; + } PSMemberInfo member = null; if (WildcardPattern.ContainsWildcardCharacters(_propertyOrMethodName)) diff --git a/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs b/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs index 104414f1fb..7149f0a2e4 100644 --- a/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs +++ b/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs @@ -452,7 +452,10 @@ namespace System.Management.Automation private static string GetEnumerableArgSeparator(ArrayLiteralAst arrayLiteralAst, int index) { - if (arrayLiteralAst == null) return " "; + if (arrayLiteralAst == null) + { + return " "; + } // index points to the *next* element, so we're looking for space between // it and the previous element. @@ -464,14 +467,25 @@ namespace System.Management.Automation var afterPrev = prev.Extent.EndOffset; var beforeNext = next.Extent.StartOffset - 1; - if (afterPrev == beforeNext) return ","; + if (afterPrev == beforeNext) + { + return ","; + } var arrayText = arrayExtent.Text; afterPrev -= arrayExtent.StartOffset; beforeNext -= arrayExtent.StartOffset; - if (arrayText[afterPrev] == ',') return ", "; - if (arrayText[beforeNext] == ',') return " ,"; + if (arrayText[afterPrev] == ',') + { + return ", "; + } + + if (arrayText[beforeNext] == ',') + { + return " ,"; + } + return " , "; } diff --git a/src/System.Management.Automation/engine/NativeCommandProcessor.cs b/src/System.Management.Automation/engine/NativeCommandProcessor.cs index ecf5e79de1..b825c024ef 100644 --- a/src/System.Management.Automation/engine/NativeCommandProcessor.cs +++ b/src/System.Management.Automation/engine/NativeCommandProcessor.cs @@ -1146,7 +1146,11 @@ namespace System.Management.Automation { lock (_sync) { - if (_stopped) return; + if (_stopped) + { + return; + } + _stopped = true; } @@ -1651,9 +1655,15 @@ namespace System.Management.Automation // we incrementing refCount on the same thread and before running any processing // so it's safe to do it without Interlocked. - if (process.StartInfo.RedirectStandardOutput) { _refCount++; } + if (process.StartInfo.RedirectStandardOutput) + { + _refCount++; + } - if (process.StartInfo.RedirectStandardError) { _refCount++; } + if (process.StartInfo.RedirectStandardError) + { + _refCount++; + } // once we have _refCount, we can start processing if (process.StartInfo.RedirectStandardOutput) diff --git a/src/System.Management.Automation/engine/ParameterBinderBase.cs b/src/System.Management.Automation/engine/ParameterBinderBase.cs index d087d5900e..af2dca4aee 100644 --- a/src/System.Management.Automation/engine/ParameterBinderBase.cs +++ b/src/System.Management.Automation/engine/ParameterBinderBase.cs @@ -770,7 +770,10 @@ namespace System.Management.Automation // Note - we explicitly don't pass the context here because we don't want // the overhead of the calls that check for stopping. - if (ParserOps.MoveNext(null, null, ienum)) { isEmpty = false; } + if (ParserOps.MoveNext(null, null, ienum)) + { + isEmpty = false; + } // If the element of the collection is of value type, then no need to check for null // because a value-type value cannot be null. diff --git a/src/powershell/Program.cs b/src/powershell/Program.cs index 1fdb1319c5..70346a1d1c 100644 --- a/src/powershell/Program.cs +++ b/src/powershell/Program.cs @@ -348,7 +348,11 @@ namespace Microsoft.PowerShell foreach (char c in str) { length++; - if (c == '\'') { length++; } + + if (c == '\'') + { + length++; + } } return length;