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 .globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ' ';
}
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/TypeMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion test/tools/TestExe/TestExe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions test/tools/WebListener/Controllers/ResumeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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}";
Expand Down Expand Up @@ -113,7 +113,7 @@ private void SetResumeResponseHeaders()
private bool TryGetRangeHeader(out string rangeHeader)
{
var rangeHeaderSv = new StringValues();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xtqqczze For my education - does an analyzer recognize the "var" pattern to convert to

            StringValues rangeHeaderSv = new();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not aware of such an analyzer, but one could use RCS1012 codefix first.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we should apply RCS1012 and then apply a fix to the new pattern?

if(Request.Headers.TryGetValue("Range", out rangeHeaderSv))
if (Request.Headers.TryGetValue("Range", out rangeHeaderSv))
{
rangeHeader = rangeHeaderSv.FirstOrDefault();
return true;
Expand Down