Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ rulers = 120

# ReSharper properties
resharper_align_multiline_statement_conditions = false
resharper_braces_for_ifelse = not_required
resharper_keep_existing_initializer_arrangement = false
resharper_trailing_comma_in_multiline_lists = false
resharper_wrap_object_and_collection_initializer_style = wrap_if_long
Expand Down Expand Up @@ -199,6 +198,8 @@ csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
csharp_style_var_elsewhere = true
dotnet_diagnostic.RCS1264.severity = none
# Add braces.
dotnet_diagnostic.IDE0011.severity = warning
# Use collection initializers or expressions.
dotnet_diagnostic.IDE0028.severity = warning
# Order modifiers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Immutable;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using HotChocolate.Fetching;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq.Expressions;
using System.Reflection;
using GreenDonut.Data;
using HotChocolate.Data.Projections.Expressions.Handlers;
using HotChocolate.Language;
using HotChocolate.Language.Visitors;
using HotChocolate.Resolvers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,10 +560,7 @@ internal void Seal()

internal void InitializePlannerTopologyCache()
{
if (_plannerTopologyCache is null)
{
_plannerTopologyCache = PlannerTopologyCache.Build(this);
}
_plannerTopologyCache ??= PlannerTopologyCache.Build(this);
}

public override string ToString()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.Immutable;
using HotChocolate.Fusion.Execution.Nodes;
using HotChocolate.Fusion.Planning.Partitioners;
using HotChocolate.Fusion.Types;
using HotChocolate.Language;

namespace HotChocolate.Fusion.Planning;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using HotChocolate.Collections.Immutable;
using HotChocolate.Execution;
using HotChocolate.Fusion.Execution.Nodes;
using HotChocolate.Fusion.Execution.Pipeline;
using HotChocolate.Fusion.Planning;
using Microsoft.Extensions.DependencyInjection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void PlannerEventSource_Emits_Start_And_Stop_With_Perf_Metrics()
var dequeueEvents = listener.ByEventId(PlannerEventSource.PlanDequeueEventId, operationId);

Assert.True(elapsedMilliseconds >= 0);
Assert.Equal((int)plan.SearchSpace, searchSpace);
Assert.Equal(plan.SearchSpace, searchSpace);
Assert.True(expandedNodes > 0);
Assert.True(stepCount > 0);
Assert.Equal(expandedNodes, dequeueEvents.Count);
Expand Down
2 changes: 2 additions & 0 deletions src/HotChocolate/Language/src/Language.Utf8/WellKnownNames.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#if !NETSTANDARD2_0
using System.Diagnostics.CodeAnalysis;
#endif
using System.Runtime.CompilerServices;

namespace HotChocolate.Language;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public void MultiSegment_SingleSegment_Sequence_Parser()
public void MultiSegment_EmptySequence_Throws()
{
// arrange
var sequence = new ReadOnlySequence<byte>(Array.Empty<byte>());
var sequence = new ReadOnlySequence<byte>([]);

// act & assert
Assert.Throws<ArgumentException>(() => new Utf8GraphQLReader(sequence));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ public TestSequenceSegment Append(ReadOnlyMemory<byte> memory)
public static ReadOnlySequence<byte> CreateMultiSegment(byte[] data, int chunkSize)
{
if (data.Length == 0)
{
throw new ArgumentException("Data cannot be empty.", nameof(data));
}

if (chunkSize <= 0)
{
throw new ArgumentException("Chunk size must be positive.", nameof(chunkSize));
}

if (chunkSize >= data.Length)
{
Expand Down Expand Up @@ -58,14 +62,20 @@ public static ReadOnlySequence<byte> CreateMultiSegment(byte[] data, int chunkSi
public static ReadOnlySequence<byte> CreateMultiSegment(byte[] data, params int[] splitPositions)
{
if (data.Length == 0)
{
throw new ArgumentException("Data cannot be empty.", nameof(data));
}

if (splitPositions.Length == 0)
{
return new ReadOnlySequence<byte>(data);
}

var positions = splitPositions.OrderBy(p => p).Where(p => p > 0 && p < data.Length).Distinct().ToArray();
if (positions.Length == 0)
{
return new ReadOnlySequence<byte>(data);
}

var first = new TestSequenceSegment(
new ReadOnlyMemory<byte>(data, 0, positions[0]), 0);
Expand Down
Loading