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
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ roslynator_null_conditional_operator.avoid_negative_boolean_comparison = true
dotnet_diagnostic.IDE0031.severity = none
# Abstract type should not have public constructors.
dotnet_diagnostic.RCS1160.severity = warning
# Unused parameter.
dotnet_diagnostic.RCS1163.severity = warning
dotnet_diagnostic.IDE0060.severity = none
# Use constant instead of field.
dotnet_diagnostic.RCS1187.severity = warning
# Unnecessary usage of verbatim string literal.
Expand Down Expand Up @@ -332,3 +335,8 @@ dotnet_diagnostic.CA1511.severity = none
dotnet_diagnostic.CA1512.severity = none
dotnet_diagnostic.CA1513.severity = none
dotnet_diagnostic.IDE0057.severity = none

# Tests
[src/**/test/**/*.cs]
# Unused parameter.
dotnet_diagnostic.RCS1163.severity = none
2 changes: 1 addition & 1 deletion src/GreenDonut/src/GreenDonut.Abstractions/Promise.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static Promise<TValue> Create(bool cloned = false)
/// Returns a new instance of <see cref="Promise{TValue}"/>.
/// </returns>
public static Promise<TValue> Create(TValue value, bool cloned = true)
=> new(System.Threading.Tasks.Task.FromResult(value), null, isClone: true);
=> new(System.Threading.Tasks.Task.FromResult(value), null, isClone: cloned);

/// <summary>
/// Implicitly converts a <see cref="TaskCompletionSource{TResult}"/> to a promise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ internal static void SetQueryInterceptor(PagingQueryInterceptor pagingQueryInter
s_interceptor.Value.Interceptor = pagingQueryInterceptor;
}

internal static void ClearQueryInterceptor(PagingQueryInterceptor pagingQueryInterceptor)
internal static void ClearQueryInterceptor()
{
if (s_interceptor.Value is not null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void Dispose()
{
if (!_disposed)
{
PagingQueryableExtensions.ClearQueryInterceptor(this);
PagingQueryableExtensions.ClearQueryInterceptor();
_disposed = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal static ObjectFieldConfiguration CreateServiceField(IDescriptorContext c
descriptor.Type<NonNullType<ObjectType<_Service>>>().Resolve(s_service);
descriptor.Configuration.PureResolver = Resolve;

static _Service Resolve(IResolverContext ctx)
static _Service Resolve(IResolverContext _)
=> s_service;

return descriptor.CreateConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void BeginExecute(CancellationToken cancellationToken)
}

/// <inheritdoc />
public Task WaitForCompletionAsync(CancellationToken cancellationToken)
public Task WaitForCompletionAsync(CancellationToken _)
=> _task ?? Task.CompletedTask;

private async Task ExecuteInternalAsync(CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected override void WriteResolversBindingInitialization(IOutputTypeInfo type
{
if (objectType.NodeResolver.RequiresParameterBindings)
{
WriteResolverBindingInitialization(objectType.NodeResolver, typeLookup);
WriteResolverBindingInitialization(objectType.NodeResolver);
}

WriteIsSelectedInitialization(objectType.NodeResolver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,12 @@ protected virtual void WriteResolversBindingInitialization(IOutputTypeInfo type,
{
foreach (var resolver in type.Resolvers)
{
WriteResolverBindingInitialization(resolver, typeLookup);
WriteResolverBindingInitialization(resolver);
WriteIsSelectedInitialization(resolver);
}
}

protected void WriteResolverBindingInitialization(Resolver resolver, ILocalTypeLookup typeLookup)
protected void WriteResolverBindingInitialization(Resolver resolver)
{
if (resolver.Member is not IMethodSymbol resolverMethod)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ public Operation Compile(
string hash,
string? operationName,
DocumentNode document,
#pragma warning disable RCS1163 // Unused parameter
IFeatureProvider context)
#pragma warning restore RCS1163 // Unused parameter
{
ArgumentException.ThrowIfNullOrWhiteSpace(id);
ArgumentNullException.ThrowIfNull(document);
Expand Down
4 changes: 3 additions & 1 deletion src/HotChocolate/Core/src/Types/Execution/ThrowHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ public static GraphQLException ResolverContext_ArgumentDoesNotExist(

public static InvalidOperationException RequestExecutorResolver_SchemaNameDoesNotMatch(
string configurationSchemaName, string schemaName) =>
new("The schema name must align with the schema name expected by the configuration.");
new(
$"The schema name ({schemaName}) must align with the schema name expected by the "
+ $"configuration ({configurationSchemaName}).");

public static GraphQLException OperationResolverHelper_NoOperationFound(
DocumentNode documentNode) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static ISchemaBuilder Map(
{
return builder.Use(
FieldClassMiddlewareFactory.Create(
(s, n) => new MapMiddleware(
(_, n) => new MapMiddleware(
n, fieldReference, middleware(n))));
}

Expand All @@ -39,7 +39,7 @@ public static ISchemaBuilder Map<TMiddleware>(
{
return builder.Use(
FieldClassMiddlewareFactory.Create(
(s, n) =>
(_, n) =>
{
var classMiddleware =
FieldClassMiddlewareFactory.Create<TMiddleware>();
Expand All @@ -56,7 +56,7 @@ public static ISchemaBuilder Map<TMiddleware>(
{
return builder.Use(
FieldClassMiddlewareFactory.Create(
(s, n) =>
(_, n) =>
{
var classMiddleware =
FieldClassMiddlewareFactory
Expand Down
2 changes: 1 addition & 1 deletion src/HotChocolate/Core/src/Types/Text/Json/ResultElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ internal ReadOnlySpan<byte> GetRawValue(bool includeQuotes = true)
{
CheckValidInstance();

return _parent.GetRawValue(_cursor, includeQuotes: true);
return _parent.GetRawValue(_cursor, includeQuotes);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public SyntaxTypeReference WithScope(string? scope = null)

public SyntaxTypeReference WithFactory(
Func<IDescriptorContext, TypeSystemObject>? factory = null)
=> new(Type, Context, Scope, Factory);
=> new(Type, Context, Scope, factory);

public SyntaxTypeReference With(
Optional<ITypeNode> type = default,
Expand Down
20 changes: 3 additions & 17 deletions src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldResolvers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ public static async ValueTask ResolveSingleNodeAsync(
}
else
{
context.ReportError(
ErrorHelper.Relay_NoNodeResolver(
typeName,
context.Path,
context.Selection));

context.ReportError(ErrorHelper.Relay_NoNodeResolver(typeName, context.Path));
context.Result = null;
}
}
Expand All @@ -66,7 +61,6 @@ public static async ValueTask ResolveManyNodeAsync(
{
context.ReportError(
ErrorHelper.FetchedToManyNodesAtOnce(
context.Selection,
context.Path,
maxAllowedNodes,
list.Items.Count));
Expand Down Expand Up @@ -99,11 +93,7 @@ public static async ValueTask ResolveManyNodeAsync(
{
tasks[i] = s_nullTask;

context.ReportError(
ErrorHelper.Relay_NoNodeResolver(
typeName,
context.Path,
context.Selection));
context.ReportError(ErrorHelper.Relay_NoNodeResolver(typeName, context.Path));
}
}

Expand Down Expand Up @@ -183,11 +173,7 @@ public static async ValueTask ResolveManyNodeAsync(
{
results[0] = null;

context.ReportError(
ErrorHelper.Relay_NoNodeResolver(
typeName,
context.Path,
context.Selection));
context.ReportError(ErrorHelper.Relay_NoNodeResolver(typeName, context.Path));
}

context.Result = results;
Expand Down
3 changes: 1 addition & 2 deletions src/HotChocolate/Core/src/Types/Utilities/ErrorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public static ISchemaError NoSchemaTypesAllowedAsRuntimeType(
.SetTypeSystemObject(type)
.Build();

public static IError Relay_NoNodeResolver(string typeName, Path path, Selection selection)
public static IError Relay_NoNodeResolver(string typeName, Path path)
=> ErrorBuilder.New()
.SetMessage(ErrorHelper_Relay_NoNodeResolver, typeName)
.SetPath(path)
Expand Down Expand Up @@ -494,7 +494,6 @@ public static ISchemaError NodeResolverMissing(
.Build();

public static IError FetchedToManyNodesAtOnce(
Selection selection,
Path path,
int maxAllowedNodes,
int requestNodes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ protected override Expression HandleListOperation(
LambdaExpression lambda) =>
FilterExpressionBuilder.All(closureType, context.GetInstance(), lambda);

public static QueryableListAllOperationHandler Create(FilterProviderContext context) => new();
public static QueryableListAllOperationHandler Create(FilterProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ protected override Expression HandleListOperation(
FilterExpressionBuilder.Not(
FilterExpressionBuilder.Any(closureType, context.GetInstance(), lambda));

public static QueryableListNoneOperationHandler Create(FilterProviderContext context) => new();
public static QueryableListNoneOperationHandler Create(FilterProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ protected override Expression HandleListOperation(
LambdaExpression lambda) =>
FilterExpressionBuilder.Any(closureType, context.GetInstance(), lambda);

public static QueryableListSomeOperationHandler Create(FilterProviderContext context) => new();
public static QueryableListSomeOperationHandler Create(FilterProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ public override bool CanHandle(
&& def.Id == Operation;
}

public static QueryableDataOperationHandler Create(FilterProviderContext context) => new();
public static QueryableDataOperationHandler Create(FilterProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public override bool TryHandleLeave(
return true;
}

public static QueryableDefaultFieldHandler Create(FilterProviderContext context) => new();
public static QueryableDefaultFieldHandler Create(FilterProviderContext _) => new();

private sealed class ReplaceVariableExpressionVisitor : ExpressionVisitor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static ISchemaBuilder AddFiltering(
Action<IFilterConventionDescriptor> configure,
string? name = null) =>
builder
.TryAddConvention<IFilterConvention>(sp => new FilterConvention(configure), name)
.TryAddConvention<IFilterConvention>(_ => new FilterConvention(configure), name)
.TryAddTypeInterceptor<FilterTypeInterceptor>()
.TryAddTypeInterceptor<DataTypeInterceptor>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@ public override bool TryHandleLeave(
return true;
}

public static QueryableProjectionFieldHandler Create(ProjectionProviderContext context) => new();
public static QueryableProjectionFieldHandler Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ public override bool TryHandleLeave(
return true;
}

public static QueryableProjectionListHandler Create(ProjectionProviderContext context) => new();
public static QueryableProjectionListHandler Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,5 @@ or ExpressionType.TypeAs
}
}

public static QueryableProjectionScalarHandler Create(ProjectionProviderContext context) => new();
public static QueryableProjectionScalarHandler Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ public void AfterProjection(QueryableProjectionContext context, Selection select
{
}

public static QueryableFilterInterceptor Create(ProjectionProviderContext context) => new();
public static QueryableFilterInterceptor Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public QueryableFirstOrDefaultInterceptor()
{
}

public static QueryableFirstOrDefaultInterceptor Create(ProjectionProviderContext context) => new();
public static QueryableFirstOrDefaultInterceptor Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ public QueryableSingleOrDefaultInterceptor()
{
}

public static QueryableSingleOrDefaultInterceptor Create(ProjectionProviderContext context) => new();
public static QueryableSingleOrDefaultInterceptor Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ public void AfterProjection(QueryableProjectionContext context, Selection select
{
}

public static QueryableSortInterceptor Create(ProjectionProviderContext context) => new();
public static QueryableSortInterceptor Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ static FieldDelegate WrappedPipeline(FieldDelegate next) =>
return selection;
}

public static QueryableFilterProjectionOptimizer Create(ProjectionProviderContext context) => new();
public static QueryableFilterProjectionOptimizer Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,5 @@ private static void CollectSelectionOfNodes(
? new SelectionSetNode(((SelectionSetNode)n).Selections)
: n);

public static QueryablePagingProjectionOptimizer Create(ProjectionProviderContext context) => new();
public static QueryablePagingProjectionOptimizer Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ static FieldDelegate WrappedPipeline(FieldDelegate next)
return selection;
}

public static QueryableSortProjectionOptimizer Create(ProjectionProviderContext context) => new();
public static QueryableSortProjectionOptimizer Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static ISchemaBuilder AddProjections(
builder
.TryAddTypeInterceptor<ProjectionTypeInterceptor>()
.TryAddConvention<IProjectionConvention>(
sp => new ProjectionConvention(configure),
_ => new ProjectionConvention(configure),
name);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ [new FieldSelectionNode(fieldNode, 0)],
return selection;
}

public static IsProjectedProjectionOptimizer Create(ProjectionProviderContext context) => new();
public static IsProjectedProjectionOptimizer Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,5 @@ private static string ToCamelCase(string value)
return char.ToLowerInvariant(value[0]) + value[1..];
}

public static QueryableRequirementsProjectionOptimizer Create(ProjectionProviderContext context) => new();
public static QueryableRequirementsProjectionOptimizer Create(ProjectionProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected override QueryableSortOperation HandleOperation(
SortEnumValue? sortEnumValue)
=> AscendingSortOperation.From(fieldSelector);

public static QueryableAscendingSortOperationHandler Create(SortProviderContext context) => new();
public static QueryableAscendingSortOperationHandler Create(SortProviderContext _) => new();

private sealed class AscendingSortOperation : QueryableSortOperation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public override bool TryHandleLeave(
return true;
}

public static QueryableDefaultSortFieldHandler Create(SortProviderContext context) => new();
public static QueryableDefaultSortFieldHandler Create(SortProviderContext _) => new();

private sealed class ReplaceVariableExpressionVisitor : ExpressionVisitor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected override QueryableSortOperation HandleOperation(
SortEnumValue? sortEnumValue)
=> DescendingSortOperation.From(fieldSelector);

public static QueryableDescendingSortOperationHandler Create(SortProviderContext context) => new();
public static QueryableDescendingSortOperationHandler Create(SortProviderContext _) => new();

private sealed class DescendingSortOperation : QueryableSortOperation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public override bool CanHandle(
IFilterInputTypeConfiguration typeConfiguration,
IFilterFieldConfiguration fieldConfiguration) => true;

public static MatchAnyQueryableFieldHandler Create(FilterProviderContext context) => new();
public static MatchAnyQueryableFieldHandler Create(FilterProviderContext _) => new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace eShop.Inventory;
public static partial class ProductNode
{
public static long? GetShippingEstimate(
[Parent] Product product,
[Require] long weight,
[Require] long price)
=> price > 1000 ? 0 : weight / 2;
Expand Down
Loading
Loading