Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed whitespace #7318

Merged
merged 2 commits into from
Aug 1, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .build/Build.Publish.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// IEnumerable<string> ChangelogSectionNotes => ExtractChangelogSectionNotes(ChangelogFile);
[Parameter("NuGet Source for Packages")] readonly string NuGetSource = "https://api.nuget.org/v3/index.json";
[Parameter("NuGet Api Key")] readonly string NuGetApiKey;
[Parameter("NuGet Source for Packages")] readonly string MyGetSource = "https://www.myget.org/F/hotchocolate/api/v3/index.json";

Check warning on line 19 in .build/Build.Publish.cs

View workflow job for this annotation

GitHub Actions / Generate Test Matrix

The field 'Build.MyGetSource' is assigned but its value is never used

Check warning on line 19 in .build/Build.Publish.cs

View workflow job for this annotation

GitHub Actions / Merge and Upload Coverage

The field 'Build.MyGetSource' is assigned but its value is never used
[Parameter("MyGet Api Key")] readonly string MyGetApiKey;

Target Pack => _ => _
Expand All @@ -41,7 +41,6 @@
*/
});


Target PackLocal => _ => _
.Produces(PackageDirectory / "*.nupkg")
.Produces(PackageDirectory / "*.snupkg")
Expand Down
1 change: 0 additions & 1 deletion .build/Build.Tests.2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ void RunTests(AbsolutePath solutionFile)
.Where(t => t.Path.ToString().StartsWith(testDirectory))
.ToArray();


Console.WriteLine("╬============================================");
Console.WriteLine("║ Prepared Tests:");
Console.WriteLine($"║ {RootDirectory.GetRelativePathTo(solutionDirectory)}:");
Expand Down
2 changes: 0 additions & 2 deletions .build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ partial class Build : NukeBuild
.OrderBy(p => p.Name)
.ToList();


var matrix = new
{
include = testProjects.Select(p => new
Expand Down Expand Up @@ -133,7 +132,6 @@ partial class Build : NukeBuild
});
}


[Serializable]
public class TestProject
{
Expand Down
2 changes: 1 addition & 1 deletion init.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cd website
yarn
cd ..
./build.cmd restore
./build.cmd restore
2 changes: 1 addition & 1 deletion init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
cd website
yarn
cd ..
./build.sh restore
./build.sh restore
2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="DefaultPushSource" value="https://api.nuget.org/v3/index.json" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public static void AppendLine(this IBufferWriter<byte> snapshot)
snapshot.GetSpan(1)[0] = (byte)'\n';
snapshot.Advance(1);
}

public static void AppendLine(this IBufferWriter<byte> snapshot, bool appendWhenTrue)
{
if (!appendWhenTrue)
{
return;
}

snapshot.GetSpan(1)[0] = (byte)'\n';
snapshot.Advance(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected override void Format(IBufferWriter<byte> snapshot, IExecutionResult va
FormatStreamAsync(snapshot, (IResponseStream)value).Wait();
}
}

protected override void FormatMarkdown(IBufferWriter<byte> snapshot, IExecutionResult value)
{
if (value.Kind is ExecutionResultKind.SingleResult)
Expand All @@ -35,7 +35,7 @@ protected override void FormatMarkdown(IBufferWriter<byte> snapshot, IExecutionR
snapshot.AppendLine();
FormatStreamAsync(snapshot, (IResponseStream)value).Wait();
}

snapshot.AppendLine();
snapshot.Append("```");
snapshot.AppendLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ private static async Task FormatStreamAsync(
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override void Format(IBufferWriter<byte> snapshot, ISyntaxNode value)

ArrayPool<char>.Shared.Return(buffer);
}

protected override void FormatMarkdown(IBufferWriter<byte> snapshot, ISyntaxNode value)
{
snapshot.Append("```graphql");
Expand All @@ -36,4 +36,4 @@ protected override void FormatMarkdown(IBufferWriter<byte> snapshot, ISyntaxNode
snapshot.Append("```");
snapshot.AppendLine();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public interface IMarkdownSnapshotValueFormatter
/// The snapshot segment vale.
/// </param>
void FormatMarkdown(IBufferWriter<byte> snapshot, object? value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public interface ISnapshotValueFormatter
/// The snapshot segment vale.
/// </param>
void Format(IBufferWriter<byte> snapshot, object? value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ internal sealed class JsonSnapshotValueFormatter : ISnapshotValueFormatter, IMar

public bool CanHandle(object? value)
=> true;

public void Format(IBufferWriter<byte> snapshot, object? value)
=> snapshot.Append(JsonConvert.SerializeObject(value, _settings));

public void FormatMarkdown(IBufferWriter<byte> snapshot, object? value)
{
snapshot.Append("```json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,43 @@ internal sealed class OperationResultSnapshotValueFormatter : SnapshotValueForma
protected override void Format(IBufferWriter<byte> snapshot, OperationResult value)
{
var next = false;

if(value.RequestIndex.HasValue)
{
snapshot.Append("RequestIndex: ");
snapshot.Append(value.RequestIndex.Value.ToString());
next = true;
}

if(value.VariableIndex.HasValue)
{
snapshot.AppendLine(appendWhenTrue: next);
snapshot.AppendLine(appendWhenTrue: next);
snapshot.Append("VariableIndex: ");
snapshot.Append(value.VariableIndex.Value.ToString());
next = true;
}

if (value.Data.ValueKind is JsonValueKind.Object)
{
snapshot.AppendLine(appendWhenTrue: next);
snapshot.Append("Data: ");
snapshot.Append(value.Data.ToString());
next = true;
}

if (value.Errors.ValueKind is JsonValueKind.Array)
{
snapshot.AppendLine(appendWhenTrue: next);
snapshot.Append("Errors: ");
snapshot.Append(value.Errors.ToString());
next = true;
}

if (value.Extensions.ValueKind is JsonValueKind.Object)
{
snapshot.AppendLine(appendWhenTrue: next);
snapshot.Append("Extensions: ");
snapshot.Append(value.Extensions.ToString());
}
}
}
}
2 changes: 1 addition & 1 deletion src/CookieCrumble/src/CookieCrumble/Snapshot.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Buffers;
using System.Buffers;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
Expand Down
2 changes: 1 addition & 1 deletion src/CookieCrumble/test/CookieCrumble.Tests/Usings.cs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
global using Xunit;
global using Xunit;
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/AutoBatchScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ private static void BeginDispatch(Func<ValueTask> dispatch)
/// Gets the default instance if the <see cref="AutoBatchScheduler"/>.
/// </summary>
public static AutoBatchScheduler Default { get; } = new();
}
}
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/Batch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ internal void ClearUnsafe()
_keys.Clear();
_items.Clear();
}
}
}
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/BatchDataLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ private void CopyResults(
protected abstract Task<IReadOnlyDictionary<TKey, TValue>> LoadBatchAsync(
IReadOnlyList<TKey> keys,
CancellationToken cancellationToken);
}
}
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/BatchPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ private static ObjectPool<Batch<TKey>> Create()
=> new DefaultObjectPool<Batch<TKey>>(
new BatchPooledObjectPolicy<TKey>(),
Environment.ProcessorCount * 4);
}
}
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/BatchPooledObjectPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public override bool Return(Batch<TKey> obj)
obj.ClearUnsafe();
return true;
}
}
}
4 changes: 2 additions & 2 deletions src/GreenDonut/src/Core/CacheDataLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
if (options.Cache is null)
{
throw new ArgumentException(
"A cache must be provided when using the CacheDataLoader.",
"A cache must be provided when using the CacheDataLoader.",
nameof(options));

Check warning on line 24 in src/GreenDonut/src/Core/CacheDataLoader.cs

View check run for this annotation

Codecov / codecov/patch

src/GreenDonut/src/Core/CacheDataLoader.cs#L23-L24

Added lines #L23 - L24 were not covered by tests
}
}

Expand Down Expand Up @@ -55,4 +55,4 @@
local.MaxBatchSize = 1;
return local;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ public static CancellationToken CreateLinkedCancellationToken(
cancellationToken)
.Token;
}
}
}
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/DataLoaderBase.Fetch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ protected abstract ValueTask FetchAsync(
IReadOnlyList<TKey> keys,
Memory<Result<TValue>> results,
CancellationToken cancellationToken);
}
}
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/DataLoaderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,4 @@ protected static string GetCacheKeyType<TDataLoader>()
/// </returns>
protected static string GetCacheKeyType(Type type)
=> type.FullName ?? type.Name;
}
}
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/DataLoaderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,4 @@ public static void Set(

dataLoader.Set(key, Task.FromResult(value));
}
}
}
4 changes: 2 additions & 2 deletions src/GreenDonut/src/Core/DataLoaderOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed class DataLoaderOptions
/// The default value is set to <c>null</c>.
/// </summary>
public ITaskCache? Cache { get; set; }

/// <summary>
/// Gets the cancellation token that shall be used for dispatch tasks.
/// </summary>
Expand All @@ -47,4 +47,4 @@ public DataLoaderOptions Copy()
DiagnosticEvents = DiagnosticEvents,
CancellationToken = CancellationToken,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ namespace GreenDonut.DependencyInjection;
/// <summary>
/// Represents a factory that creates a DataLoader instance.
/// </summary>
public delegate T DataLoaderFactory<out T>(IServiceProvider serviceProvider)
where T : IDataLoader;
public delegate T DataLoaderFactory<out T>(IServiceProvider serviceProvider)
where T : IDataLoader;
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace GreenDonut.DependencyInjection;
public sealed class DataLoaderRegistration
{
private readonly DataLoaderFactory _factory;
public DataLoaderRegistration(Type instanceType)

public DataLoaderRegistration(Type instanceType)
: this(instanceType, instanceType) { }

public DataLoaderRegistration(Type serviceType, Type instanceType)
Expand Down Expand Up @@ -53,4 +53,4 @@ public DataLoaderRegistration(Type serviceType, Type instanceType, DataLoaderFac
/// </returns>
public IDataLoader CreateDataLoader(IServiceProvider services)
=> _factory(services);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static IServiceCollection TryAddDataLoaderCore(
this IServiceCollection services)
{
services.TryAddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>();

services.AddSingleton<DataLoaderScopeFactory>();
services.TryAddScoped<IDataLoaderScope>(sp => sp.GetRequiredService<DataLoaderScopeFactory>().CreateScope(sp));
services.TryAddScoped<IBatchScheduler, AutoBatchScheduler>();
Expand Down Expand Up @@ -100,7 +100,7 @@ internal sealed class DataLoaderScopeFactory
{
#if NET8_0_OR_GREATER
private readonly FrozenDictionary<Type, DataLoaderRegistration> _registrations;
#else
#else
private readonly Dictionary<Type, DataLoaderRegistration> _registrations;
#endif

Expand All @@ -126,7 +126,6 @@ file sealed class DefaultDataLoaderScope(
{
private readonly ConcurrentDictionary<string, IDataLoader> _dataLoaders = new();


public T GetDataLoader<T>(DataLoaderFactory<T> createDataLoader, string? name = null) where T : IDataLoader
{
name ??= CreateKey<T>();
Expand Down Expand Up @@ -155,4 +154,4 @@ private T CreateDataLoader<T>() where T : IDataLoader

private static string CreateKey<T>()
=> typeof(T).FullName ?? typeof(T).Name;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace GreenDonut.DependencyInjection;

/// <summary>
/// The DataLoader scope provides access to the DataLoader bound to the current execution.
/// The DataLoader scope provides access to the DataLoader bound to the current execution.
/// </summary>
public interface IDataLoaderScope
{
Expand Down Expand Up @@ -33,4 +33,3 @@ public interface IDataLoaderScope
/// </returns>
T GetDataLoader<T>() where T : IDataLoader;
}

2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/Errors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public static InvalidOperationException CreateKeysAndValuesMustMatch(

return error;
}
}
}
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/FetchDataDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ public delegate ValueTask FetchDataDelegate<in TKey, TValue>(
IReadOnlyList<TKey> keys,
Memory<Result<TValue>> results,
CancellationToken cancellationToken)
where TKey : notnull;
where TKey : notnull;
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/FetchOnceDataLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected FetchOnceDataLoader(DataLoaderOptions options)
if (options.Cache is null)
{
throw new ArgumentException(
"A cache must be provided when using the FetchOnceDataLoader.",
"A cache must be provided when using the FetchOnceDataLoader.",
nameof(options));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/GreenDonut/src/Core/GroupedDataLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ private void CopyResults(
protected abstract Task<ILookup<TKey, TValue>> LoadGroupedBatchAsync(
IReadOnlyList<TKey> keys,
CancellationToken cancellationToken);
}
}
Loading
Loading