Skip to content

Commit 3223c94

Browse files
Code cleanup
1 parent c3286f8 commit 3223c94

File tree

131 files changed

+310
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+310
-297
lines changed

build/CodingStyle.ruleset

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<Rule Id="CA1028" Action="None" /> <!-- Enum storage should be Int32 -->
77
<Rule Id="CA1030" Action="None" /> <!-- Use events where appropriate -->
88
<Rule Id="CA1031" Action="None" /> <!-- Do not catch general exception types -->
9+
<Rule Id="CA1032" Action="None" /> <!-- Implement standard exception constructors -->
910
<Rule Id="CA1034" Action="None" /> <!-- Nested types should not be visible -->
1011
<Rule Id="CA1036" Action="None" /> <!-- Overload comparison operators when implementing System.IComparable -->
1112
<Rule Id="CA1043" Action="None" /> <!-- Use integral or string argument for indexers -->
@@ -18,6 +19,7 @@
1819
<Rule Id="CA1058" Action="None" /> <!-- Types should not extend certain base types -->
1920
<Rule Id="CA1061" Action="None" /> <!-- Do not hide base class methods -->
2021
<Rule Id="CA1062" Action="None" /> <!-- Validate arguments of public methods -->
22+
<Rule Id="CA1063" Action="None" /> <!-- Implement IDisposable correctly -->
2123
<Rule Id="CA1064" Action="None" /> <!-- Exceptions should be public -->
2224
<Rule Id="CA1065" Action="None" /> <!-- Do not raise exceptions in unexpected locations -->
2325
<Rule Id="CA1066" Action="None" /> <!-- Type should implement IEquatable -->
@@ -37,15 +39,21 @@
3739
<Rule Id="CA1717" Action="None" /> <!-- Only FlagsAttribute enums should have plural names -->
3840
<Rule Id="CA1720" Action="None" /> <!-- Identifier contains type name -->
3941
<Rule Id="CA1721" Action="None" /> <!-- Property names should not match get methods -->
42+
<Rule Id="CA1724" Action="None" /> <!-- Type names should not match namespaces -->
4043
<Rule Id="CA1801" Action="None" /> <!-- Review unused parameters -->
4144
<Rule Id="CA1806" Action="None" /> <!-- Do not ignore method results -->
45+
<Rule Id="CA1810" Action="None" /> <!-- Initialize reference type static fields inline -->
4246
<Rule Id="CA1812" Action="None" /> <!-- Avoid uninstantiated internal classes -->
4347
<Rule Id="CA1814" Action="None" /> <!-- Prefer jagged arrays over multidimensional -->
4448
<Rule Id="CA1815" Action="None" /> <!-- Override equals and operator equals on value types -->
4549
<Rule Id="CA1816" Action="None" /> <!-- Dispose methods should call SuppressFinalize -->
4650
<Rule Id="CA1819" Action="None" /> <!-- Properties should not return arrays -->
4751
<Rule Id="CA1820" Action="None" /> <!-- Test for empty strings using string length -->
4852
<Rule Id="CA1822" Action="None" /> <!-- Mark members as static -->
53+
<Rule Id="CA1826" Action="None" /> <!-- Do not use Enumerable methods on indexable collections. Instead use the collection directly -->
54+
<Rule Id="CA2208" Action="None" /> <!-- Instantiate argument exceptions correctly -->
55+
<Rule Id="CA2000" Action="None" /> <!-- Dispose objects before losing scope -->
56+
<Rule Id="CA2008" Action="None" /> <!-- Do not create tasks without passing a TaskScheduler -->
4957
<Rule Id="CA2010" Action="None" /> <!-- Always consume the value returned by methods marked with PreserveSigAttribute -->
5058
<Rule Id="CA2100" Action="None" /> <!-- Review SQL queries for security vulnerabilities -->
5159
<Rule Id="CA2101" Action="None" /> <!-- Specify marshaling for P/Invoke string arguments -->
@@ -89,6 +97,7 @@
8997
<Rule Id="SA1110" Action="None" /> <!-- Opening parenthesis or bracket should be on declaration line -->
9098
<Rule Id="SA1111" Action="None" /> <!-- Closing parenthesis should be on line of last parameter -->
9199
<Rule Id="SA1114" Action="None" /> <!-- Parameter list should follow declaration -->
100+
<Rule Id="SA1115" Action="None" /> <!-- The parameter should begin on the line after the previous parameter -->
92101
<Rule Id="SA1116" Action="None" /> <!-- Split parameters should start on line after declaration -->
93102
<Rule Id="SA1117" Action="None" /> <!-- Parameters should be on same line or separate lines -->
94103
<Rule Id="SA1118" Action="None" /> <!-- Parameter should not span multiple lines -->
@@ -115,6 +124,7 @@
115124
<Rule Id="SA1202" Action="None" /> <!-- Elements should be ordered by access -->
116125
<Rule Id="SA1203" Action="None" /> <!-- Constants should appear before fields -->
117126
<Rule Id="SA1204" Action="None" /> <!-- Static elements should appear before instance elements -->
127+
<Rule Id="SA1206" Action="None" /> <!-- The 'static' modifier should appear before 'new' -->
118128
<Rule Id="SA1208" Action="None" /> <!-- Using directive ordering -->
119129
<Rule Id="SA1209" Action="None" /> <!-- Using alias directives should be placed after all using namespace directives -->
120130
<Rule Id="SA1210" Action="None" /> <!-- Using directives should be ordered alphabetically by the namespaces -->

samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<PlatformTarget>AnyCPU</PlatformTarget>
1212
<DebugType>pdbonly</DebugType>
1313
<DebugSymbols>true</DebugSymbols>
14+
<NoWarn>$(NoWarn);CA1018;CA5351</NoWarn>
1415
</PropertyGroup>
1516
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
1617
<Reference Include="System.Reflection" />

samples/BenchmarkDotNet.Samples/IntroCultureInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public Config()
1717
CultureInfo.NumberFormat.NumberDecimalSeparator = "@";
1818
}
1919
}
20-
20+
2121
[Benchmark]
2222
public void Foo() => Thread.Sleep(100);
2323
}

samples/BenchmarkDotNet.Samples/IntroCustomMonoArguments.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public void Sample()
3636
ShouldGetInlined(); ShouldGetInlined(); ShouldGetInlined();
3737
}
3838

39-
void ShouldGetInlined() { }
39+
private void ShouldGetInlined() { }
4040
}
4141
}

samples/BenchmarkDotNet.Samples/IntroDisassembly.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace BenchmarkDotNet.Samples
66
[DisassemblyDiagnoser]
77
public class IntroDisassembly
88
{
9-
int[] field = Enumerable.Range(0, 100).ToArray();
9+
private int[] field = Enumerable.Range(0, 100).ToArray();
1010

1111
[Benchmark]
1212
public int SumLocal()

samples/BenchmarkDotNet.Samples/IntroDisassemblyRyuJit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace BenchmarkDotNet.Samples
77
[RyuJitX64Job]
88
public class IntroDisassemblyRyuJit
99
{
10-
int[] field = Enumerable.Range(0, 100).ToArray();
10+
private int[] field = Enumerable.Range(0, 100).ToArray();
1111

1212
[Benchmark]
1313
public int SumLocal()

samples/BenchmarkDotNet.Samples/IntroEventPipeProfiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using BenchmarkDotNet.Attributes;
33
using BenchmarkDotNet.Diagnosers;
44

5-
namespace BenchmarkDotNet.Samples
5+
namespace BenchmarkDotNet.Samples
66
{
77
[ShortRunJob]
88
[EventPipeProfiler(EventPipeProfile.CpuSampling)]

samples/BenchmarkDotNet.Samples/IntroInliningDiagnoser.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
using BenchmarkDotNet.Attributes;
2-
using BenchmarkDotNet.Configs;
32
using System.Runtime.CompilerServices;
43

54
namespace BenchmarkDotNet.Samples
65
{
7-
[Diagnostics.Windows.Configs.InliningDiagnoser(logFailuresOnly: false, allowedNamespaces: new [] { "BenchmarkDotNet.Samples" })]
6+
[Diagnostics.Windows.Configs.InliningDiagnoser(logFailuresOnly: false, allowedNamespaces: new[] { "BenchmarkDotNet.Samples" })]
87
public class IntroInliningDiagnoser
98
{
109
[Benchmark]

samples/BenchmarkDotNet.Samples/IntroOutliers.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using BenchmarkDotNet.Attributes;
33
using BenchmarkDotNet.Configs;
44
using BenchmarkDotNet.Jobs;
5-
using BenchmarkDotNet.Mathematics;
65
using Perfolizer.Mathematics.OutlierDetection;
76

87
namespace BenchmarkDotNet.Samples

samples/BenchmarkDotNet.Samples/IntroRatioSD.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Threading;
22
using BenchmarkDotNet.Attributes;
33
using BenchmarkDotNet.Engines;
4-
using BenchmarkDotNet.Mathematics;
54
using Perfolizer.Mathematics.OutlierDetection;
65

76
namespace BenchmarkDotNet.Samples

0 commit comments

Comments
 (0)