From cd4d51ed2828f6742d8d4781f90e7f819565f75c Mon Sep 17 00:00:00 2001 From: xtqqczze Date: Mon, 2 Nov 2020 22:04:38 +0000 Subject: [PATCH] Enable SA1000: Keywords should be spaced correctly https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1000.md --- .globalconfig | 2 +- .../commands/utility/UnblockFile.cs | 4 ++-- .../host/msh/ProgressPane.cs | 4 ++-- src/System.Management.Automation/engine/TypeMetadata.cs | 2 +- test/tools/TestExe/TestExe.cs | 2 +- test/tools/WebListener/Controllers/ResumeController.cs | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.globalconfig b/.globalconfig index ced5ff22453..3d1040cc86b 100644 --- a/.globalconfig +++ b/.globalconfig @@ -1010,7 +1010,7 @@ dotnet_diagnostic.SA0001.severity = none dotnet_diagnostic.SA0002.severity = none # SA1000: Keywords should be spaced correctly -dotnet_diagnostic.SA1000.severity = none +dotnet_diagnostic.SA1000.severity = warning # SA1001: Commas should be spaced correctly dotnet_diagnostic.SA1001.severity = none diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs index b13d310771b..9bf48fd55c9 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs @@ -147,10 +147,10 @@ protected override void ProcessRecord() foreach (string path in pathsToProcess) { - if(IsBlocked(path)) + if (IsBlocked(path)) { UInt32 result = RemoveXattr(path, MacBlockAttribute, RemovexattrFollowSymLink); - if(result != 0) + if (result != 0) { string errorMessage = string.Format(CultureInfo.CurrentUICulture, UnblockFileStrings.UnblockError, path); Exception e = new InvalidOperationException(errorMessage); diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs index 9edc44a0aab..7918f6f6814 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs @@ -102,9 +102,9 @@ class ProgressPane // create cleared region to clear progress bar later _savedRegion = tempProgressRegion; - for(int row = 0; row < rows; row++) + for (int row = 0; row < rows; row++) { - for(int col = 0; col < cols; col++) + for (int col = 0; col < cols; col++) { _savedRegion[row, col].Character = ' '; } diff --git a/src/System.Management.Automation/engine/TypeMetadata.cs b/src/System.Management.Automation/engine/TypeMetadata.cs index 372497a0261..f513331ad59 100644 --- a/src/System.Management.Automation/engine/TypeMetadata.cs +++ b/src/System.Management.Automation/engine/TypeMetadata.cs @@ -978,7 +978,7 @@ private string GetProxyAttributeData(Attribute attrib, string prefix) string or = string.Empty; string[] regexOptionEnumValues = Enum.GetNames(typeof(System.Text.RegularExpressions.RegexOptions)); - foreach(string regexOption in regexOptionEnumValues) + foreach (string regexOption in regexOptionEnumValues) { System.Text.RegularExpressions.RegexOptions option = (System.Text.RegularExpressions.RegexOptions) Enum.Parse( typeof(System.Text.RegularExpressions.RegexOptions), diff --git a/test/tools/TestExe/TestExe.cs b/test/tools/TestExe/TestExe.cs index c8f91d4d38e..0eac8074de0 100644 --- a/test/tools/TestExe/TestExe.cs +++ b/test/tools/TestExe/TestExe.cs @@ -13,7 +13,7 @@ private static int Main(string[] args) { if (args.Length > 0) { - switch(args[0].ToLowerInvariant()) + switch (args[0].ToLowerInvariant()) { case "-echoargs": EchoArgs(args); diff --git a/test/tools/WebListener/Controllers/ResumeController.cs b/test/tools/WebListener/Controllers/ResumeController.cs index ebcfad40d78..623744ab7d8 100644 --- a/test/tools/WebListener/Controllers/ResumeController.cs +++ b/test/tools/WebListener/Controllers/ResumeController.cs @@ -30,12 +30,12 @@ public async void Index() if (TryGetRangeHeader(out rangeHeader)) { var range = GetRange(rangeHeader); - if(range.From != null) + if (range.From != null) { from = (int)range.From; } - if(range.To != null) + if (range.To != null) { to = (int)range.To; } @@ -49,7 +49,7 @@ public async void Index() return; } - if(to >= FileBytes.Length || from >= FileBytes.Length) + if (to >= FileBytes.Length || from >= FileBytes.Length) { Response.StatusCode = StatusCodes.Status416RequestedRangeNotSatisfiable; Response.Headers[HeaderNames.ContentRange] = $"bytes */{FileBytes.Length}"; @@ -113,7 +113,7 @@ private void SetResumeResponseHeaders() private bool TryGetRangeHeader(out string rangeHeader) { var rangeHeaderSv = new StringValues(); - if(Request.Headers.TryGetValue("Range", out rangeHeaderSv)) + if (Request.Headers.TryGetValue("Range", out rangeHeaderSv)) { rangeHeader = rangeHeaderSv.FirstOrDefault(); return true;