Runtime: Is/should there a code-style for avoiding null on left side of a binary expression?

Created on 8 Aug 2020  路  21Comments  路  Source: dotnet/runtime

Is there are code-style for avoiding null on left side of a binary expression? If not an explicit requirement, maybe a guideline?
https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/coding-style.md
https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1098.md

area-Meta question

All 21 comments

Note that we do have this for the C++ code styling guide already: https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/clr-jit-coding-conventions.md#1517-if-conditions

I don't think Yoda conditions are really common enough of a pattern to see in the .NET world. Maybe that's why it's not specifically mentioned there...

IMO, if we ever decide to add this in the rule then it should just be about the whole Yoda notation instead of just nulls.

Searching by "Yoda", I'm seeing some PR reviews in the runtime/coreclr/corefx that asks people to avoid using Yoda conditions in C# code: https://github.com/dotnet/runtime/pull/33603#discussion_r392640073 https://github.com/dotnet/runtime/pull/38161#discussion_r445155678 https://github.com/dotnet/runtime/pull/38001#discussion_r441750671 https://github.com/dotnet/corefx/pull/31827#discussion_r211139251 so it probably was just missed out for not being common.

Enabling SA1131 results in 222 warnings for Clr+Libs build.

List

src\Internal\Runtime\InteropServices\ComponentActivator.cs(185,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\ActivityTracker.cs(394,25): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\EventCounter.cs(104,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Collections\Generic\ArraySortHelper.cs(634,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Collections\Generic\ArraySortHelper.cs(635,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\GC.cs(136,18): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\GC.cs(153,18): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\GC.cs(351,38): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\TraceLogging\Statics.cs(176,33): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\ActivityTracker.cs(461,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\ActivityTracker.cs(498,28): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\MathF.cs(300,27): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\EventPipeEventDispatcher.cs(216,35): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Math.cs(904,27): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Collections\ArrayList.cs(2661,25): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Collections\HashHelpers.cs(82,56): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Collections\HashHelpers.cs(84,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\TraceLogging\FieldMetadata.cs(190,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\TraceLogging\FieldMetadata.cs(199,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\TraceLogging\FieldMetadata.cs(206,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\TraceLogging\FieldMetadata.cs(216,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\EventProvider.cs(511,34): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\EventProvider.cs(642,45): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(175,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(177,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(193,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(195,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(210,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(212,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(229,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(397,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(604,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(671,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Resources\ResourceManager.cs(674,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\InteropServices\ComWrappers.cs(342,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\InteropServices\ComWrappers.cs(373,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\InteropServices\Marshal.CoreCLR.cs(280,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\Serialization\SerializationInfo.cs(64,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\Serialization\SerializationInfo.cs(79,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\Serialization\SerializationInfo.cs(125,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\Serialization\SerializationInfo.cs(148,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\Serialization\SerializationInfo.cs(163,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\Serialization\SerializationInfo.cs(288,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\Serialization\SerializationInfo.cs(289,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\Serialization\SerializationInfo.cs(290,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\Serialization\SerializationInfo.cs(306,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\IO\BufferedStream.cs(1261,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\EventSource.cs(4155,28): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\IO\FileStream.cs(656,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\IO\FileStream.cs(659,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(108,18): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(113,23): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(118,23): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(549,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(585,57): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(586,57): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(587,58): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(588,57): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(589,57): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(590,58): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(591,58): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(592,59): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(593,59): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs(594,60): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Reflection\MdImport.cs(187,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Runtime\InteropServices\Marshal.Windows.cs(49,20): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\EventSource.cs(5817,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\IO\FileStreamCompletionSource.Win32.cs(158,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\EventSource.cs(3249,54): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\EventSource.cs(3469,20): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\EventSource.cs(1610,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventSource.cs(822,22): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventSource.cs(822,42): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventSource.cs(839,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventSource.cs(843,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventSource.cs(847,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(50,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(79,34): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(79,78): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(102,35): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(102,80): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(122,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(215,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(250,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(271,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(506,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(488,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(498,72): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(498,93): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(521,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(426,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(443,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(467,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(151,42): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(152,28): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(477,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\StringBuilder.CoreCLR.cs(148,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(305,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(371,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\StubHelpers.cs(415,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\String.Comparison.cs(561,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ValueType.cs(27,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\String.Comparison.cs(880,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Utf8String.cs(242,38): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Reflection\AssemblyNameFormatter.cs(76,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\ThreadPool.cs(765,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\ThreadPool.cs(726,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\ThreadPool.cs(728,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\ThreadPool.cs(733,38): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\ThreadPool.cs(459,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\StringBuilder.cs(654,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\StringBuilder.cs(693,28): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\ASCIIUtility.cs(103,34): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\String.cs(496,38): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\ThreadPool.cs(1179,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\ASCIIUtility.cs(264,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\ASCIIUtility.cs(530,34): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Utf8Span.Searching.cs(343,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\ASCIIUtility.cs(708,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\StringBuilder.cs(2355,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Buffers\Text\Utf8Parser\Utf8Parser.Boolean.cs(44,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\ASCIIUtility.cs(1390,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\ASCIIUtility.cs(1647,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\UTF8Encoding.Sealed.cs(66,34): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\UTF8Encoding.Sealed.cs(100,34): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\EncoderFallback.cs(137,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Boolean.cs(84,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Buffers\Text\Utf8Formatter\Utf8Formatter.Boolean.cs(68,25): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Buffers\Text\Utf8Formatter\Utf8Formatter.Boolean.cs(78,25): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Latin1Utility.cs(27,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Latin1Utility.cs(28,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Buffers\Text\Utf8Formatter\Utf8Formatter.Date.L.cs(18,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\ManualResetEventSlim.cs(97,20): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Buffers\Text\Utf8Formatter\Utf8Formatter.Date.R.cs(18,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Latin1Utility.cs(81,34): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\Mutex.Windows.cs(71,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\Mutex.Windows.cs(71,73): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\Mutex.Windows.cs(73,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Threading\Mutex.Windows.cs(75,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Rune.cs(318,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Rune.cs(410,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Rune.cs(535,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Rune.cs(542,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Rune.cs(819,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(232,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(259,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Unicode\Utf8.cs(105,25): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Unicode\Utf16Utility.Validation.cs(33,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(495,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(496,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Latin1Utility.cs(257,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(525,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(526,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Unicode\Utf16Utility.Validation.cs(54,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\TimeZoneInfo.cs(274,39): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(818,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(845,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\CalendricalCalculationsHelper.cs(163,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\CalendricalCalculationsHelper.cs(176,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\CalendricalCalculationsHelper.cs(169,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\CalendricalCalculationsHelper.cs(183,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\CalendricalCalculationsHelper.cs(154,50): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\CalendricalCalculationsHelper.cs(190,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(1083,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(1084,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(1113,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Encoding.Internal.cs(1114,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\DateTimeFormat.cs(1213,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Latin1Utility.cs(864,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Text\Latin1Utility.cs(994,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\CalendricalCalculationsHelper.cs(401,22): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Convert.cs(2751,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Convert.cs(2766,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Convert.cs(2796,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Convert.cs(2819,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Convert.cs(2823,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\CultureInfo.cs(306,25): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\IdnMapping.cs(477,50): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\TimeSpanFormat.cs(631,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\TimeSpanFormat.cs(632,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\TimeSpanFormat.cs(633,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\TimeSpanFormat.cs(634,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\TimeSpanFormat.cs(635,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\IdnMapping.cs(704,42): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\PersianCalendar.cs(138,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\PersianCalendar.cs(178,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Net\WebUtility.cs(272,96): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Net\WebUtility.cs(617,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.Dragon4.cs(454,31): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\DateTimeFormatInfo.cs(2040,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\DateTimeFormatInfo.cs(2041,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\DateTimeFormatInfo.cs(2043,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\DateTimeFormatInfo.cs(2043,46): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Globalization\DateTimeFormatInfo.cs(2043,68): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(43,22): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Numerics\Matrix4x4.cs(1670,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(131,22): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(236,22): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(256,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(287,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(292,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(298,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ReadOnlySpan.cs(156,20): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Span.cs(162,20): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(374,23): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(396,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(426,21): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(431,26): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\ParseNumbers.cs(443,17): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\SpanHelpers.Byte.cs(469,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.NumberToFloatingPointBits.cs(310,27): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.NumberToFloatingPointBits.cs(326,27): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.Grisu3.cs(438,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.Grisu3.cs(439,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.Grisu3.cs(490,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.Grisu3.cs(491,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.Grisu3.cs(582,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.Grisu3.cs(666,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.Grisu3.cs(755,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\Number.Grisu3.cs(847,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\SpanHelpers.T.cs(27,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]
src\System\SpanHelpers.T.cs(452,30): error SA1131: Constant values should appear on the right-hand side of comparisons [C:\Users\gotos\source\repos\runtime\src\coreclr\src\System.Private.CoreLib\System.Private.CoreLib.csproj]

@Gnbrkm41 would it make sense to do a PR to fix those warnings, enable the setting, and update the code style guide? I am happy to do this.

Not sure, probably other folks can decide. After all I'm just a contributor >.>

Note that some of the code are direct port of some other libraries in C/C++. Number.Grisu3.cs is one example - Perhaps it's not worth converting those to keep it in sync?

@jkotas You have been involved in the code style guide previously. What are your thoughts on this?

I do not have an opinion on this one.

@danmosemsft ?

I believe we have a defacto preference for avoiding Yoda's (preference, we have...). There is no safety advantage except for bools and it isn't how you read it in your head (if null is Foo vs if Foo is null)

@bartonjs who normally is opinionated about style on the team?

Plus consistency is good if nothing else and it sounds like there's an analyzer and a volunteer.

it isn't how you read it in your head

Not always. For example, the analyzer complains about Debug.Assert(0 <= index && index <= searchSpaceLength);

@bartonjs who normally is opinionated about style on the team?

While I believe you're asking me who (else) is normally opinionated, without the question mark (and inserting a comma) it just becomes "Jeremy, who normally is opinionated", which holds, too :smile:.

When it comes to style preferences, I'm possibly the most opinionated (or just the most vocal), followed by @stephentoub. The rule, when I ask myself what my rule is, is "the most important thing goes on the left". But I'm having a hard time imagining a case where I'd write a left-constant. Certainly back in my early days of C# I was still a left-conster from my C days, but now I think I'm a right conster. (And even though I don't personally like is null and is not null in the language, I'll say "and the new pattern match null doesn't work for left-null").

Given that we already have some stylecop things turned on, I think I'd be OK with adding this to the list. This is reinforcedsanity-checked by none of the files in the "where did this happen?" list looking like ones I've edited.

it just becomes "Jeremy, who normally is opinionated", which holds, too 馃槃.

Lol

OK I think this is a tentative consensus..
@elachlan do you want to offer a PR? Maybe if there are going to be a lot of changes just limit to a few libraries initially and we can see what it looks like?

You mentioned there's an analyzer, I'm not sure what our criteria are for the level of quality of analyzers we allow in our build process but at least it should help you find them for your effort even if we don't use in our build .

@danmosemsft Sure. Do you want me to update the code style guide as well? What language do you want to use for the rule?

I suggest just a code PR first so we can get an idea of what the scale of the changes are.

What language do you want to use for the rule?

I don't follow...we're not suggesting you write an analyzer. We don't store them in this repo anyway.

I suggest just a code PR first so we can get an idea of what the scale of the changes are.

What language do you want to use for the rule?

I don't follow...we're not suggesting you write an analyzer. We don't store them in this repo anyway.

sorry, I meant the wording of the rule in the Code Style Guide.

I'll get the PR sorted first :)

Roslynator has a vs extension which allows refactoring. So it doesn't need to be included in the project. It only deals with nulls on the left side though vs the stylecop analyzer which finds all constants on the left hand side.

https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1098.md

Is there a way to open src\libraries\Common\src as a solution? That would make it a lot easier.

@elachlan no I don't think so. Can you enable the rule, build, and pipe the output through VS or VS Code or some other tool that makes the errors clickable? (I'm assuming it doesn't auto fix?)

Is there a way to open src\libraries\Common\src as a solution? That would make it a lot easier.

@elachlan not sure if this is what you are looking for but if you are trying to automatically detect/apply a rule/fix across multiple projects you can run this script https://github.com/dotnet/runtime/blob/master/src/libraries/GenerateLibrariesSln.ps1 which creates a solution with all the csprojs in src/libraries, after that just open Libraries.src.Generated.sln, look for the rule prompt in VS and hit Fix all occurrences in solution.

@Jozkee thank you so much, this makes it so much easier!

Was this page helpful?
0 / 5 - 0 ratings