Skip to content

Commit 51d6b81

Browse files
committed
Code cleanup
1 parent 0b7692c commit 51d6b81

25 files changed

+45
-122
lines changed

.editorconfig

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,20 @@ dotnet_diagnostic.BL0006.severity = none
4444

4545
[*.cs]
4646

47+
dotnet_diagnostic.IDE0022.severity = silent # IDE0022: Use block body for methods
48+
dotnet_diagnostic.IDE0090.severity = silent # IDE0090: Use 'new(...)'
4749
dotnet_diagnostic.S125.severity = suggestion # S125: Sections of code should not be commented out
4850
dotnet_diagnostic.S927.severity = suggestion # S927: Parameter names should match base declaration and other partial definitions
4951
dotnet_diagnostic.S1075.severity = suggestion # S1075: URIs should not be hardcoded
50-
dotnet_diagnostic.S1186.severity = suggestion # S1186: Methods should not be empty
52+
dotnet_diagnostic.S1186.severity = silent # S1186: Methods should not be empty
5153
dotnet_diagnostic.S1199.severity = suggestion # S1199: Nested code blocks should not be used
5254
dotnet_diagnostic.S3925.severity = suggestion # S3925: "ISerializable" should be implemented correctly
5355

54-
[tests/**.cs]
56+
[src/bunit.web/EventDispatchExtensions/**.cs]
57+
dotnet_diagnostic.S107.severity = none # S107: Methods should not have too many parameters
5558

56-
dotnet_diagnostic.S3459.severity = suggestion # S3459: Unassigned members should be removed
59+
[tests/**.cs]
60+
dotnet_diagnostic.S125.severity = none # S125: Sections of code should not be commented out
61+
dotnet_diagnostic.CA2012.severity = none # CA2012: Use ValueTasks correctly
62+
dotnet_diagnostic.S3459.severity = none # S3459: Unassigned members should be removed
63+
dotnet_diagnostic.S1186.severity = none # S1186: Methods should not be empty

src/Directory.Build.props

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@
4646
<PackageReference Include="Microsoft.AspNetCore.Components" Version="5.0.0" />
4747
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0" />
4848
</ItemGroup>
49-
49+
5050
<ItemGroup>
5151
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
5252
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="All" />
53-
</ItemGroup>
53+
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.15.0.24505">
54+
<PrivateAssets>all</PrivateAssets>
55+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
56+
</PackageReference>
57+
</ItemGroup>
5458
</Project>

src/bunit.core/ComponentParameter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
using System;
2-
using System.Diagnostics.CodeAnalysis;
32

43
namespace Bunit
54
{
65
/// <summary>
76
/// Represents a single parameter supplied to an <see cref="Microsoft.AspNetCore.Components.IComponent"/>
87
/// component under test.
98
/// </summary>
10-
[SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "<Pending>")]
119
public readonly struct ComponentParameter : IEquatable<ComponentParameter>
1210
{
1311
/// <summary>

src/bunit.core/GlobalSuppressions.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/bunit.web/GlobalSuppressions.cs

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/bunit.web/JSInterop/BunitJSInterop.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ public BunitJSInterop()
4141
{
4242
Mode = JSRuntimeMode.Strict;
4343
JSRuntime = new BunitJSRuntime(this);
44+
#if NET5_0
4445
AddCustomHandlers();
46+
#endif
4547
}
4648

4749
/// <summary>
@@ -83,13 +85,13 @@ internal virtual void RegisterInvocation(JSRuntimeInvocation invocation)
8385
return result;
8486
}
8587

88+
#if NET5_0
8689
private void AddCustomHandlers()
8790
{
88-
#if NET5_0
8991
AddInvocationHandler(new FocusAsyncInvocationHandler());
9092
AddInvocationHandler(new VirtualizeJSRuntimeInvocationHandler());
9193
AddInvocationHandler(new LooseModeJSObjectReferenceInvocationHandler(this));
92-
#endif
9394
}
95+
#endif
9496
}
9597
}

src/bunit.xunit/GlobalSuppressions.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,9 @@
3636
<PackageReference Include="AutoFixture.Xunit2" Version="4.14.0" />
3737
<PackageReference Include="Xunit.Combinatorial" Version="1.4.1" />
3838
<PackageReference Include="coverlet.msbuild" Version="2.9.0" PrivateAssets="All" />
39+
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.15.0.24505">
40+
<PrivateAssets>all</PrivateAssets>
41+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
42+
</PackageReference>
3943
</ItemGroup>
4044
</Project>

tests/bunit.core.tests/ComponentParameterCollectionTest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using Bunit.TestDoubles;
43
using Microsoft.AspNetCore.Components;
54
using Microsoft.AspNetCore.Components.Rendering;
65
using Shouldly;

tests/bunit.core.tests/GlobalSuppressions.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)