Skip to content

Commit 803a58a

Browse files
authored
Removed unnecessary initialization (#8392)
1 parent 646700f commit 803a58a

File tree

20 files changed

+27
-24
lines changed

20 files changed

+27
-24
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ dotnet_diagnostic.CA1511.severity = warning
167167
dotnet_diagnostic.CA1512.severity = warning
168168
# Use ObjectDisposedException throw helper.
169169
dotnet_diagnostic.CA1513.severity = warning
170+
# Do not initialize unnecessarily.
171+
dotnet_diagnostic.CA1805.severity = warning
172+
dotnet_diagnostic.RCS1129.severity = none
170173
# Remove unnecessary cast.
171174
dotnet_diagnostic.IDE0004.severity = warning
172175
# Remove unnecessary using directives.

src/HotChocolate/AspNetCore/src/AspNetCore/GraphQLServerOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public sealed class GraphQLServerOptions
2929
/// <summary>
3030
/// Defines if GraphQL HTTP GET requests are allowed.
3131
/// </summary>
32-
public bool EnforceGetRequestsPreflightHeader { get; set; } = false;
32+
public bool EnforceGetRequestsPreflightHeader { get; set; }
3333

3434
/// <summary>
3535
/// Defines if GraphQL HTTP Multipart requests are allowed.

src/HotChocolate/Core/test/Execution.Tests/Instrumentation/DiagnosticListenerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public async Task Intercept_Resolver_Result_With_Multiple_Listener()
7070

7171
public class Touched
7272
{
73-
public bool Signal = false;
73+
public bool Signal;
7474
}
7575

7676
private class TouchedListener : ExecutionDiagnosticEventListener

src/HotChocolate/Core/test/Fetching.Tests/AutoCacheDataLoaderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected override Task<Cat> LoadSingleAsync(string key, CancellationToken cance
8787

8888
public static class CounterStore
8989
{
90-
private static int s_catCounter = 0;
90+
private static int s_catCounter;
9191

9292
public static int GetNextCatCount() => Interlocked.Increment(ref s_catCounter);
9393
}

src/HotChocolate/Core/test/Subscriptions.Tests/DefaultTopicTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected override ValueTask<IDisposable> OnConnectAsync(CancellationToken cance
7171

7272
private class StubDisposableSession : IDisposable
7373
{
74-
public bool DisposableCalled { get; private set; } = false;
74+
public bool DisposableCalled { get; private set; }
7575

7676
public void Dispose()
7777
{
@@ -81,7 +81,7 @@ public void Dispose()
8181

8282
private class StubAsyncDisposableSession : StubDisposableSession, IAsyncDisposable
8383
{
84-
public bool AsyncDisposableCalled { get; private set; } = false;
84+
public bool AsyncDisposableCalled { get; private set; }
8585

8686
public ValueTask DisposeAsync()
8787
{

src/HotChocolate/Core/test/Types.Tests/Configuration/TypeDiscoveryTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,6 @@ public class QueryTypeWithCustomLocalDate
174174

175175
public class LocalDate
176176
{
177-
public DateOnly Date { get; set; } = new();
177+
public DateOnly Date { get; set; }
178178
}
179179
}

src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/Conventions/DefaultTypeInspectorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ public class DoNotInfer
764764

765765
public void ReturnsVoid() { }
766766

767-
public object ObjectProp { get; } = null;
767+
public object ObjectProp { get; }
768768

769769
public string ByRefParameter(ref string s) => s;
770770

src/HotChocolate/Core/test/Types.Tests/Types/InputParserTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,6 @@ public class Test4Input
564564
{
565565
public string Field1 { get; set; } = null!;
566566

567-
public int Field2 { get; set; } = 0;
567+
public int Field2 { get; set; }
568568
}
569569
}

src/HotChocolate/CostAnalysis/src/CostAnalysis/CostMetrics.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ namespace HotChocolate.CostAnalysis;
44
public sealed record CostMetrics
55
{
66
/// <summary>https://ibm.github.io/graphql-specs/cost-spec.html#sec-Field-Cost</summary>
7-
public double FieldCost { get; init; } = 0;
7+
public double FieldCost { get; init; }
88

99
/// <summary>https://ibm.github.io/graphql-specs/cost-spec.html#sec-Type-Cost</summary>
10-
public double TypeCost { get; init; } = 0;
10+
public double TypeCost { get; init; }
1111
}

src/HotChocolate/CostAnalysis/src/CostAnalysis/Options/CostOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace HotChocolate.CostAnalysis;
55
/// </summary>
66
public sealed class CostOptions
77
{
8-
private bool _skipAnalyzer = false;
8+
private bool _skipAnalyzer;
99
private bool _enforceCostLimits = true;
1010

1111
/// <summary>

0 commit comments

Comments
 (0)