Skip to content

Commit 5fca791

Browse files
authored
Placed new line before binary operators (ChilliCream#8445)
1 parent f3cc595 commit 5fca791

547 files changed

Lines changed: 3873 additions & 3870 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ dotnet_diagnostic.IDE0305.severity = silent # see https://github.com/dotnet/rosl
244244
# Use collection expression for new.
245245
dotnet_diagnostic.IDE0306.severity = warning
246246
dotnet_style_prefer_collection_expression = when_types_exactly_match
247+
# Place new line after/before binary operator.
248+
dotnet_diagnostic.RCS0027.severity = warning
249+
roslynator_binary_operator_new_line = before
247250
# Remove unnecessary blank line.
248251
dotnet_diagnostic.RCS0063.severity = warning
249252
dotnet_diagnostic.RCS1036.severity = none # see https://github.com/dotnet/roslynator/issues/1632

src/CookieCrumble/src/CookieCrumble.HotChocolate/Extensions/SnapshotExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public static Snapshot AddResult(
5151
? "Result:"
5252
: $"{name} Result:");
5353

54-
if (result.ContextData.TryGetValue("query", out var queryResult) &&
55-
queryResult is string queryString &&
56-
!string.IsNullOrWhiteSpace(queryString))
54+
if (result.ContextData.TryGetValue("query", out var queryResult)
55+
&& queryResult is string queryString
56+
&& !string.IsNullOrWhiteSpace(queryString))
5757
{
5858
snapshot.Add(
5959
queryString,

src/CookieCrumble/src/CookieCrumble/Snapshot.cs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -624,30 +624,30 @@ private static string CreateFileName(StackFrame[] frames)
624624
var method = stackFrame.GetMethod();
625625
var fileName = stackFrame.GetFileName();
626626

627-
if (method is not null &&
628-
!string.IsNullOrEmpty(fileName) &&
629-
s_testFramework.IsValidTestMethod(method))
627+
if (method is not null
628+
&& !string.IsNullOrEmpty(fileName)
629+
&& s_testFramework.IsValidTestMethod(method))
630630
{
631631
return Combine(GetDirectoryName(fileName)!, method.ToName());
632632
}
633633

634634
method = EvaluateAsynchronousMethodBase(method);
635635

636-
if (method is not null &&
637-
!string.IsNullOrEmpty(fileName) &&
638-
s_testFramework.IsValidTestMethod(method))
636+
if (method is not null
637+
&& !string.IsNullOrEmpty(fileName)
638+
&& s_testFramework.IsValidTestMethod(method))
639639
{
640640
return Combine(GetDirectoryName(fileName)!, method.ToName());
641641
}
642642
}
643643

644644
throw new Exception(
645-
"The snapshot full name could not be evaluated. " +
646-
"This error can occur, if you use the snapshot match " +
647-
"within an async test helper child method. To solve this issue, " +
648-
"use the Snapshot.FullName directly in the unit test to " +
649-
"get the snapshot name, then reach this name to your " +
650-
"Snapshot.Match method.");
645+
"The snapshot full name could not be evaluated. "
646+
+ "This error can occur, if you use the snapshot match "
647+
+ "within an async test helper child method. To solve this issue, "
648+
+ "use the Snapshot.FullName directly in the unit test to "
649+
+ "get the snapshot name, then reach this name to your "
650+
+ "Snapshot.Match method.");
651651
}
652652

653653
private static string CreateMarkdownTitle(StackFrame[] frames)
@@ -657,30 +657,30 @@ private static string CreateMarkdownTitle(StackFrame[] frames)
657657
var method = stackFrame.GetMethod();
658658
var fileName = stackFrame.GetFileName();
659659

660-
if (method is not null &&
661-
!string.IsNullOrEmpty(fileName) &&
662-
s_testFramework.IsValidTestMethod(method))
660+
if (method is not null
661+
&& !string.IsNullOrEmpty(fileName)
662+
&& s_testFramework.IsValidTestMethod(method))
663663
{
664664
return method.Name;
665665
}
666666

667667
method = EvaluateAsynchronousMethodBase(method);
668668

669-
if (method is not null &&
670-
!string.IsNullOrEmpty(fileName) &&
671-
s_testFramework.IsValidTestMethod(method))
669+
if (method is not null
670+
&& !string.IsNullOrEmpty(fileName)
671+
&& s_testFramework.IsValidTestMethod(method))
672672
{
673673
return method.Name;
674674
}
675675
}
676676

677677
throw new Exception(
678-
"The snapshot full name could not be evaluated. " +
679-
"This error can occur, if you use the snapshot match " +
680-
"within an async test helper child method. To solve this issue, " +
681-
"use the Snapshot.FullName directly in the unit test to " +
682-
"get the snapshot name, then reach this name to your " +
683-
"Snapshot.Match method.");
678+
"The snapshot full name could not be evaluated. "
679+
+ "This error can occur, if you use the snapshot match "
680+
+ "within an async test helper child method. To solve this issue, "
681+
+ "use the Snapshot.FullName directly in the unit test to "
682+
+ "get the snapshot name, then reach this name to your "
683+
+ "Snapshot.Match method.");
684684
}
685685

686686
private static MethodInfo? EvaluateAsynchronousMethodBase(MemberInfo? method)
@@ -696,8 +696,8 @@ private static string CreateMarkdownTitle(StackFrame[] frames)
696696
from methodInfo in classDeclaringType.GetMethods()
697697
let stateMachineAttribute = methodInfo
698698
.GetCustomAttribute<AsyncStateMachineAttribute>()
699-
where stateMachineAttribute != null &&
700-
stateMachineAttribute.StateMachineType == methodDeclaringType
699+
where stateMachineAttribute != null
700+
&& stateMachineAttribute.StateMachineType == methodDeclaringType
701701
select methodInfo;
702702

703703
actualMethodInfo = selectedMethodInfos.SingleOrDefault();
@@ -714,9 +714,9 @@ private static void CheckStrictMode()
714714
|| (bool.TryParse(value, out var b) && b))
715715
{
716716
s_testFramework.ThrowTestException(
717-
"Strict mode is enabled and no snapshot has been found " +
718-
"for the current test. Create a new snapshot locally and " +
719-
"rerun your tests.");
717+
"Strict mode is enabled and no snapshot has been found "
718+
+ "for the current test. Create a new snapshot locally and "
719+
+ "rerun your tests.");
720720
}
721721
}
722722

src/CookieCrumble/src/CookieCrumble/Utilities/TestEnvironment.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public static bool IsCIEnvironment()
3333
{
3434
return bool.TryParse(
3535
Environment.GetEnvironmentVariable("CI_BUILD"),
36-
out var result) &&
37-
result;
36+
out var result)
37+
&& result;
3838
}
3939

4040
public static CancellationTokenSource CreateCancellationTokenSource(TimeSpan? timeSpan = null)

src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ namespace CookieCrumble;
1010
public class SnapshotTests
1111
{
1212
private const string StrictModeExceptionMessage =
13-
"Strict mode is enabled and no snapshot has been found " +
14-
"for the current test. Create a new snapshot locally and " +
15-
"rerun your tests.";
13+
"Strict mode is enabled and no snapshot has been found "
14+
+ "for the current test. Create a new snapshot locally and "
15+
+ "rerun your tests.";
1616

1717
static SnapshotTests()
1818
{

src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExtractOrderPropertiesVisitor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ internal sealed class ExtractOrderPropertiesVisitor : ExpressionVisitor
1414

1515
protected override Expression VisitMethodCall(MethodCallExpression node)
1616
{
17-
if (node.Method.Name == OrderByMethod ||
18-
node.Method.Name == ThenByMethod ||
19-
node.Method.Name == OrderByDescendingMethod ||
20-
node.Method.Name == ThenByDescendingMethod)
17+
if (node.Method.Name == OrderByMethod
18+
|| node.Method.Name == ThenByMethod
19+
|| node.Method.Name == OrderByDescendingMethod
20+
|| node.Method.Name == ThenByDescendingMethod)
2121
{
2222
_isOrderScope = true;
2323

src/GreenDonut/src/GreenDonut/DependencyInjection/DataLoaderRegistrar.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public DataLoaderRegistrar(IEnumerable<DataLoaderRegistration> registrations)
2424

2525
foreach (var registration in map.Values.ToList())
2626
{
27-
if (registration.ServiceType != registration.InstanceType &&
28-
!map.ContainsKey(registration.InstanceType))
27+
if (registration.ServiceType != registration.InstanceType
28+
&& !map.ContainsKey(registration.InstanceType))
2929
{
3030
map[registration.InstanceType] = registration;
3131
}

src/GreenDonut/src/GreenDonut/Errors.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ public static InvalidOperationException CreateKeysAndValuesMustMatch(
66
int keysCount,
77
int valuesCount)
88
{
9-
var error = new InvalidOperationException("Fetch should have " +
10-
$"returned exactly \"{keysCount}\" value(s), but instead " +
11-
$"returned \"{valuesCount}\" value(s).");
9+
var error = new InvalidOperationException("Fetch should have "
10+
+ $"returned exactly \"{keysCount}\" value(s), but instead "
11+
+ $"returned \"{valuesCount}\" value(s).");
1212

1313
return error;
1414
}

src/GreenDonut/test/GreenDonut.Tests/DataLoaderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ ValueTask Fetch(
329329
}
330330

331331
[Fact(DisplayName =
332-
"LoadAsync: Should result in a list of error results and cleaning up the " +
333-
"cache because the key and value list count are not equal")]
332+
"LoadAsync: Should result in a list of error results and cleaning up the "
333+
+ "cache because the key and value list count are not equal")]
334334
public async Task LoadKeyAndValueCountNotEqual()
335335
{
336336
// arrange

src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public override void OnAfterInitialize(
6464
ITypeDiscoveryContext discoveryContext,
6565
TypeSystemConfiguration configuration)
6666
{
67-
if (discoveryContext.Type is ObjectType objectType &&
68-
configuration is ObjectTypeConfiguration objectTypeCfg)
67+
if (discoveryContext.Type is ObjectType objectType
68+
&& configuration is ObjectTypeConfiguration objectTypeCfg)
6969
{
7070
ApplyMethodLevelReferenceResolvers(
7171
objectType,
@@ -149,8 +149,8 @@ public override void OnAfterCompleteName(
149149
var hasRuntimeType = (IHasRuntimeType)configuration;
150150
var type = hasRuntimeType.RuntimeType;
151151

152-
if (type != typeof(object) &&
153-
type.IsDefined(typeof(PackageAttribute)))
152+
if (type != typeof(object)
153+
&& type.IsDefined(typeof(PackageAttribute)))
154154
{
155155
RegisterImport(type);
156156
return;
@@ -239,8 +239,8 @@ private void RegisterImports()
239239
throw new SchemaException(
240240
SchemaErrorBuilder.New()
241241
.SetMessage(
242-
"The following federation types were used and are not supported by " +
243-
"the current federation version: {0}",
242+
"The following federation types were used and are not supported by "
243+
+ "the current federation version: {0}",
244244
string.Join(", ", import.Value))
245245
.Build());
246246
}
@@ -340,8 +340,8 @@ public override void OnAfterMakeExecutable(
340340
ITypeCompletionContext completionContext,
341341
TypeSystemConfiguration configuration)
342342
{
343-
if (completionContext.Type is ObjectType type &&
344-
configuration is ObjectTypeConfiguration typeCfg)
343+
if (completionContext.Type is ObjectType type
344+
&& configuration is ObjectTypeConfiguration typeCfg)
345345
{
346346
CompleteExternalFieldSetters(type, typeCfg);
347347
CompleteReferenceResolver(typeCfg);
@@ -456,8 +456,8 @@ private void AddToUnionIfHasTypeLevelKeyDirective(
456456
ObjectType objectType,
457457
ObjectTypeConfiguration objectTypeCfg)
458458
{
459-
if (objectTypeCfg.Directives.FirstOrDefault(d => d.Value is KeyDirective) is { } keyDirective &&
460-
((KeyDirective)keyDirective.Value).Resolvable)
459+
if (objectTypeCfg.Directives.FirstOrDefault(d => d.Value is KeyDirective) is { } keyDirective
460+
&& ((KeyDirective)keyDirective.Value).Resolvable)
461461
{
462462
_entityTypes.Add(objectType);
463463
return;
@@ -536,8 +536,8 @@ private void AddMemberTypesToTheEntityUnionType(
536536
ITypeCompletionContext completionContext,
537537
TypeSystemConfiguration? definition)
538538
{
539-
if (completionContext.Type is _EntityType &&
540-
definition is UnionTypeConfiguration unionTypeCfg)
539+
if (completionContext.Type is _EntityType
540+
&& definition is UnionTypeConfiguration unionTypeCfg)
541541
{
542542
foreach (var objectType in _entityTypes)
543543
{

0 commit comments

Comments
 (0)