Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Code cleanup and formatting for System.Memory src and test#28875

Merged
ahsonkhan merged 14 commits intodotnet:masterfrom
ahsonkhan:CleanupCode
May 23, 2018
Merged

Code cleanup and formatting for System.Memory src and test#28875
ahsonkhan merged 14 commits intodotnet:masterfrom
ahsonkhan:CleanupCode

Conversation

@ahsonkhan
Copy link

Each set of changes is a separate commit.

Related PR on the coreclr side: dotnet/coreclr#17451

cc @dotnet/corefxlab-contrib, @stephentoub, @jkotas

case 0x5468752c /* 'Thu,' */: dayOfWeek = DayOfWeek.Thursday; break;
case 0x4672692c /* 'Fri,' */: dayOfWeek = DayOfWeek.Friday; break;
case 0x5361742c /* 'Sat,' */: dayOfWeek = DayOfWeek.Saturday; break;
case 0x53756E2c /* 'Sun,' */:
Copy link
Member

Choose a reason for hiding this comment

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

I think this change makes the code less readable.

case 0x4f637420 /* 'Oct ' */ : month = 10; break;
case 0x4e6f7620 /* 'Nov ' */ : month = 11; break;
case 0x44656320 /* 'Dec ' */ : month = 12; break;
case 0x4a616e20 /* 'Jan ' */ :
Copy link
Member

Choose a reason for hiding this comment

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

same for this switch change

@joshfree
Copy link
Member

joshfree commented Apr 6, 2018

20:59:42 System\ValueTuple\ValueTuple.cs(249,72): error CS0117: 'HashHelpers' does not contain a definition for 'RandomSeed' [D:\j\workspace\windows-TGrou---2a8f9c29\src\System.ValueTuple\src\System.ValueTuple.csproj]
20:59:42     0 Warning(s)
20:59:42     1 Error(s)

While it's great to cleanup code formatting, this type of change is unnecessary risk to the RC milestone. Please hold off on merging this until master becomes 2.2 later this month.

@joshfree joshfree added this to the 2.2.0 milestone Apr 6, 2018
internal static class HashHelpers
{
public static readonly int RandomSeed = Guid.NewGuid().GetHashCode();
public static readonly int s_randomSeed = Guid.NewGuid().GetHashCode();
Copy link
Member

Choose a reason for hiding this comment

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

We don't use the s_ naming for public fields.

Copy link
Author

Choose a reason for hiding this comment

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

I didn't know that. We should add that as an exception to our coding style guidelines.

return true;

return TryParseAsSpecialFloatingPoint<double>(source, double.PositiveInfinity, double.NegativeInfinity, double.NaN, out value, out bytesConsumed);
return TryParseAsSpecialFloatingPoint(source, double.PositiveInfinity, double.NegativeInfinity, double.NaN, out value, out bytesConsumed);
Copy link

Choose a reason for hiding this comment

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

The float version of this method specifies the generic type explicitly - they should stay consistent. (And I'd prefer you keep it explicit. We don't need to jump to accomodate every time the VS IDE whines that the compiler can figure something out. We don't write source code just for the compiler's sake.)

// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Diagnostics;
Copy link

Choose a reason for hiding this comment

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

Personally, I don't think we need go out of our way to remove using System.Diagnostics. Encouraging the use of assertions by removing friction from its use is more valuable than removing every bit of white-font from the IDE.

Copy link
Member

@joshfree joshfree left a comment

Choose a reason for hiding this comment

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

Approved for 2.2

@ahsonkhan ahsonkhan added the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Apr 11, 2018
}

var dayAbbrev = DayAbbreviationsLowercase[(int)value.DayOfWeek];
var dayAbbrev = s_dayAbbreviationsLowercase[(int)value.DayOfWeek];
Copy link
Member

Choose a reason for hiding this comment

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

var => whatever type this is... same for the other such cases

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Other than the remaining feedback, LGTM. Please squash when merging.

@stephentoub
Copy link
Member

@ahsonkhan, are you still working on this?

@ahsonkhan
Copy link
Author

are you still working on this?

I will refresh the PR to address the feedback in a couple of days. Thanks for the reminder.

@stephentoub stephentoub removed the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label May 11, 2018
@ahsonkhan
Copy link
Author

@dotnet-bot test Windows x64 Debug Build

@ahsonkhan
Copy link
Author

@dotnet-bot test NETFX x86 Release Build
@dotnet-bot test Windows x64 Debug Build

@ahsonkhan
Copy link
Author

@dotnet-bot test Windows x64 Debug Build

@ahsonkhan ahsonkhan merged commit 84f5ac7 into dotnet:master May 23, 2018
@ahsonkhan ahsonkhan deleted the CleanupCode branch May 23, 2018 00:31
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…refx#28875)

* Cleanup code formatting.

* IDE0001  C# Name can be simplified.

* IDE0013  C# Name can be simplified.

* IDE1006  C# Naming rule violation: Missing prefix: 's_'

* C# Naming rule violation: Missing prefix: 's_'

* Remove unnecessary using statements.

* IDE1006  C# Naming rule violation: These words must begin with upper case characters: s_maxBufferSize

* Code formatting of test files.

* Cleanup use of pragma warning disable directives in tests.

* IDE1005  C# Delegate invocation can be simplified.

* IDE1006  C# Naming rule violation: These words must begin with upper case characters: e0

* Fix use of RandomSeed and TestEnum values due to variable rename

* Address PR feedback


Commit migrated from dotnet/corefx@84f5ac7
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants