Skip to content

Commit da43e0b

Browse files
authored
chore: Replace StyleCop.Analyzer library to unstable version (#2796)
* chore: replace stylecop to unstable package * chore: fix target-typed new statement spacing that raise SA1000 errors by stylecop * fix: SA1141 value tuple error that raised by stylecop
1 parent aeedf36 commit da43e0b

Some content is hidden

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

53 files changed

+114
-113
lines changed

build/common.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@
6565
<PrivateAssets>all</PrivateAssets>
6666
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
6767
</PackageReference>
68-
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
68+
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556">
6969
<PrivateAssets>all</PrivateAssets>
70+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
7071
</PackageReference>
7172
</ItemGroup>
7273

src/BenchmarkDotNet.Diagnostics.Windows/JitStatsDiagnoser.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected override void AttachToEvents(TraceEventSession session, BenchmarkCase
6060

6161
private sealed class MethodsJittedDescriptor : IMetricDescriptor
6262
{
63-
internal static readonly MethodsJittedDescriptor Instance = new ();
63+
internal static readonly MethodsJittedDescriptor Instance = new();
6464

6565
public string Id => nameof(MethodsJittedDescriptor);
6666
public string DisplayName => "Methods JITted";
@@ -75,7 +75,7 @@ private sealed class MethodsJittedDescriptor : IMetricDescriptor
7575

7676
private sealed class MethodsTieredDescriptor : IMetricDescriptor
7777
{
78-
internal static readonly MethodsTieredDescriptor Instance = new ();
78+
internal static readonly MethodsTieredDescriptor Instance = new();
7979

8080
public string Id => nameof(MethodsTieredDescriptor);
8181
public string DisplayName => "Methods Tiered";
@@ -90,7 +90,7 @@ private sealed class MethodsTieredDescriptor : IMetricDescriptor
9090

9191
private sealed class JitAllocatedMemoryDescriptor : IMetricDescriptor
9292
{
93-
internal static readonly JitAllocatedMemoryDescriptor Instance = new ();
93+
internal static readonly JitAllocatedMemoryDescriptor Instance = new();
9494

9595
public string Id => nameof(JitAllocatedMemoryDescriptor);
9696
public string DisplayName => "JIT allocated memory";

src/BenchmarkDotNet.TestAdapter/BenchmarkExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace BenchmarkDotNet.TestAdapter
1515
/// </summary>
1616
internal class BenchmarkExecutor
1717
{
18-
private readonly CancellationTokenSource cts = new ();
18+
private readonly CancellationTokenSource cts = new();
1919

2020
/// <summary>
2121
/// Runs all the benchmarks in the given assembly, updating the TestExecutionRecorder as they get run.

src/BenchmarkDotNet.TestAdapter/Remoting/BenchmarkExecutorWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace BenchmarkDotNet.TestAdapter.Remoting
88
/// </summary>
99
internal class BenchmarkExecutorWrapper : MarshalByRefObject
1010
{
11-
private readonly BenchmarkExecutor benchmarkExecutor = new ();
11+
private readonly BenchmarkExecutor benchmarkExecutor = new();
1212

1313
public void RunBenchmarks(string assemblyPath, TestExecutionRecorderWrapper recorder, HashSet<Guid>? benchmarkIds = null)
1414
{

src/BenchmarkDotNet.TestAdapter/VSTestEventProcessor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ internal class VsTestEventProcessor : EventProcessor
2525
private readonly Dictionary<Guid, TestCase> cases;
2626
private readonly TestExecutionRecorderWrapper recorder;
2727
private readonly CancellationToken cancellationToken;
28-
private readonly Stopwatch runTimerStopwatch = new ();
29-
private readonly Dictionary<Guid, TestResult> testResults = new ();
30-
private readonly HashSet<Guid> sentTestResults = new ();
28+
private readonly Stopwatch runTimerStopwatch = new();
29+
private readonly Dictionary<Guid, TestResult> testResults = new();
30+
private readonly HashSet<Guid> sentTestResults = new();
3131

3232
public VsTestEventProcessor(
3333
List<TestCase> cases,

src/BenchmarkDotNet/Columns/StatisticalTestColumn.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public class StatisticalTestColumn(Threshold threshold, SignificanceLevel? signi
1515
{
1616
private static readonly SignificanceLevel DefaultSignificanceLevel = SignificanceLevel.P1E5;
1717

18-
public static StatisticalTestColumn CreateDefault() => new (new PercentValue(10).ToThreshold());
18+
public static StatisticalTestColumn CreateDefault() => new(new PercentValue(10).ToThreshold());
1919

20-
public static StatisticalTestColumn Create(Threshold threshold, SignificanceLevel? significanceLevel = null) => new (threshold, significanceLevel);
20+
public static StatisticalTestColumn Create(Threshold threshold, SignificanceLevel? significanceLevel = null) => new(threshold, significanceLevel);
2121

2222
public static StatisticalTestColumn Create(string threshold, SignificanceLevel? significanceLevel = null)
2323
{

src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static (bool isSuccess, IConfig config, CommandLineOptions options) Parse
9595

9696
private static (bool Success, string[] ExpandedTokens) ExpandResponseFile(string[] args, ILogger logger)
9797
{
98-
List<string> result = new ();
98+
List<string> result = new();
9999
foreach (var arg in args)
100100
{
101101
if (arg.StartsWith("@"))

src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static IEnumerable<string> GetCurrentProcessInstructionSets(Platform platform)
9797

9898
private static string GetShortAvx512Representation()
9999
{
100-
StringBuilder avx512 = new ("AVX-512F");
100+
StringBuilder avx512 = new("AVX-512F");
101101
if (IsX86Avx512CDSupported) avx512.Append("+CD");
102102
if (IsX86Avx512BWSupported) avx512.Append("+BW");
103103
if (IsX86Avx512DQSupported) avx512.Append("+DQ");

src/BenchmarkDotNet/Detectors/CpuDetector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ namespace BenchmarkDotNet.Detectors;
1111

1212
public class CpuDetector(params ICpuDetector[] detectors) : ICpuDetector
1313
{
14-
public static CpuDetector CrossPlatform => new (
14+
public static CpuDetector CrossPlatform => new(
1515
new WindowsCpuDetector(),
1616
new LinuxCpuDetector(),
1717
new MacOsCpuDetector());
1818

19-
private static readonly Lazy<CpuInfo?> LazyCpu = new (() => CrossPlatform.Detect());
19+
private static readonly Lazy<CpuInfo?> LazyCpu = new(() => CrossPlatform.Detect());
2020
public static CpuInfo? Cpu => LazyCpu.Value;
2121

2222
public bool IsApplicable() => detectors.Any(loader => loader.IsApplicable());

src/BenchmarkDotNet/Detectors/OsDetector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ namespace BenchmarkDotNet.Detectors;
1313

1414
public class OsDetector
1515
{
16-
public static readonly OsDetector Instance = new ();
16+
public static readonly OsDetector Instance = new();
1717
private OsDetector() { }
1818

1919
internal static string ExecutableExtension => IsWindows() ? ".exe" : string.Empty;
2020
internal static string ScriptFileExtension => IsWindows() ? ".bat" : ".sh";
2121

22-
private readonly Lazy<OsInfo> os = new (ResolveOs);
22+
private readonly Lazy<OsInfo> os = new(ResolveOs);
2323
public static OsInfo GetOs() => Instance.os.Value;
2424

2525
private static OsInfo ResolveOs()

0 commit comments

Comments
 (0)