Skip to content

Commit cf0d38a

Browse files
authored
Ordered named arguments according to the order of parameters (#8423)
1 parent 08817b3 commit cf0d38a

File tree

26 files changed

+77
-73
lines changed

26 files changed

+77
-73
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ dotnet_diagnostic.RCS1118.severity = warning
252252
dotnet_diagnostic.RCS1160.severity = warning
253253
# Use constant instead of field.
254254
dotnet_diagnostic.RCS1187.severity = warning
255+
# Order named arguments according to the order of parameters.
256+
dotnet_diagnostic.RCS1205.severity = warning
255257
# Convert interpolated string to concatenation.
256258
dotnet_diagnostic.RCS1217.severity = warning
257259
# Unnecessary null-forgiving operator.

src/HotChocolate/AspNetCore/test/AspNetCore.Tests/IntrospectionTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,15 @@ public async Task Introspection_OfType_Depth_2_OK()
222222
private GraphQLHttpClient GetClient(string environment, bool removeRule = false)
223223
{
224224
var server = CreateStarWarsServer(
225-
environment: environment,
226225
configureServices: s =>
227226
{
228227
if (removeRule)
229228
{
230229
s.AddGraphQL()
231230
.DisableIntrospection(disable: false);
232231
}
233-
});
232+
},
233+
environment: environment);
234234
return new DefaultGraphQLHttpClient(server.CreateClient());
235235
}
236236
}

src/HotChocolate/AspNetCore/test/Transport.Http.Tests/GraphQLHttpClientTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,11 @@ query B($episode: Episode!) {
347347
}
348348
}
349349
""",
350+
operationName: "B",
350351
variables: new Dictionary<string, object?>
351352
{
352353
["episode"] = "JEDI"
353-
},
354-
operationName: "B");
354+
});
355355

356356
var requestUri = new Uri(CreateUrl("/graphql"));
357357

@@ -587,11 +587,11 @@ query B($episode: Episode!) {
587587
}
588588
}
589589
""",
590+
operationName: "B",
590591
variables: new Dictionary<string, object?>
591592
{
592593
["episode"] = "JEDI"
593-
},
594-
operationName: "B");
594+
});
595595

596596
var requestUri = new Uri(CreateUrl("/graphql"));
597597

src/HotChocolate/Caching/test/Caching.Tests/HttpCachingTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public async Task SharedMaxAgeAndScope_Should_Cache()
356356
d.Name("Query")
357357
.Field("field")
358358
.Resolve("")
359-
.CacheControl(sharedMaxAge: 2000, scope: CacheControlScope.Public));
359+
.CacheControl(scope: CacheControlScope.Public, sharedMaxAge: 2000));
360360
});
361361

362362
var client = server.CreateClient();

src/HotChocolate/Core/src/Authorization/AuthorizeAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ protected internal override void TryConfigure(
8787

8888
private AuthorizeDirective CreateDirective()
8989
{
90-
return new AuthorizeDirective(apply: Apply, policy: Policy, roles: Roles);
90+
return new AuthorizeDirective(Policy, Roles, Apply);
9191
}
9292
}

src/HotChocolate/Core/src/Execution/Processing/OperationCompiler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,11 @@ selection.SelectionSet is not null
446446
selection.SelectionSet.Selections))
447447
: selection,
448448
responseName: responseName,
449-
isParallelExecutable: field.IsParallelExecutable,
450449
arguments: CoerceArgumentValues(field, selection, responseName),
451450
includeConditions: includeCondition == 0
452451
? null
453-
: [includeCondition]);
452+
: [includeCondition],
453+
isParallelExecutable: field.IsParallelExecutable);
454454

455455
context.Fields.Add(responseName, preparedSelection);
456456

src/HotChocolate/Core/src/Execution/Processing/Result/ResultBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ public IOperationResult BuildResult()
259259
_errors.Count == 0 ? null : _errors.ToArray(),
260260
CreateExtensionData(_extensions),
261261
CreateExtensionData(_contextData),
262-
incremental: null,
263262
items: _items,
263+
incremental: null,
264264
label: _label,
265265
path: _path,
266266
hasNext: _hasNext,

src/HotChocolate/Core/src/Subscriptions.RabbitMQ/RabbitMQTopic.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ private AsyncEventingBasicConsumer CreateConsumer(IModel channel, string queueNa
7878
exclusive: true,
7979
autoDelete: false);
8080
channel.QueueBind(
81-
exchange: Name,
8281
queue: queueName,
82+
exchange: Name,
8383
routingKey: string.Empty);
8484

8585
return new AsyncEventingBasicConsumer(channel);

src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ private void TryApplyInputConvention(
261261
Create<MutationConventionMiddleware>(
262262
(typeof(string), options.InputArgumentName),
263263
(typeof(IReadOnlyList<ResolverArgument>), resolverArguments)),
264-
key: MutationArguments,
265-
isRepeatable: false);
264+
isRepeatable: false,
265+
key: MutationArguments);
266266

267267
mutation.Arguments.Clear();
268268
mutation.Arguments.Add(new(options.InputArgumentName, type: Parse($"{inputTypeName}!")));
@@ -353,8 +353,8 @@ private void TryApplyPayloadConvention(
353353
var nullMiddleware = _errorNullMiddleware ??=
354354
new FieldMiddlewareConfiguration(
355355
Create<ErrorNullMiddleware>(),
356-
key: MutationErrorNull,
357-
isRepeatable: false);
356+
isRepeatable: false,
357+
key: MutationErrorNull);
358358

359359
foreach (var resultField in payloadTypeDef.Fields)
360360
{
@@ -410,8 +410,8 @@ private void TryApplyPayloadConvention(
410410
new FieldMiddlewareConfiguration(
411411
Create<ErrorMiddleware>(
412412
(typeof(IReadOnlyList<CreateError>), errorFactories)),
413-
key: MutationErrors,
414-
isRepeatable: false);
413+
isRepeatable: false,
414+
key: MutationErrors);
415415

416416
// last but not least we insert the error middleware to the mutation field.
417417
mutation.MiddlewareConfigurations.Insert(0, errorMiddleware);
@@ -440,8 +440,8 @@ private void TryApplyPayloadConvention(
440440
new FieldMiddlewareConfiguration(
441441
Create<ErrorMiddleware>(
442442
(typeof(IReadOnlyList<CreateError>), errorFactories)),
443-
key: MutationErrors,
444-
isRepeatable: false);
443+
isRepeatable: false,
444+
key: MutationErrors);
445445

446446
mutation.MiddlewareConfigurations.Insert(0, errorMiddleware);
447447
}

src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ public override void OnBeforeCompleteTypes()
147147
new FieldMiddlewareConfiguration(
148148
FieldClassMiddlewareFactory.Create<QueryResultMiddleware>(
149149
(typeof(IReadOnlyList<CreateError>), errorFactories)),
150-
key: "Query Results",
151-
isRepeatable: false);
150+
isRepeatable: false,
151+
key: "Query Results");
152152

153153
// last but not least we insert the result middleware to the query field.
154154
field.MiddlewareConfigurations.Insert(0, errorMiddleware);

0 commit comments

Comments
 (0)