Skip to content

Commit

Permalink
Merge branch 'main' into pse/adjust-example-for-mutation-conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib authored Dec 14, 2023
2 parents 90f5e8e + 926ba54 commit 98af61c
Show file tree
Hide file tree
Showing 423 changed files with 2,016 additions and 1,562 deletions.
30 changes: 25 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ dotnet_style_qualification_for_event = false:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error

# Modifier preferences
dotnet_style_require_accessibility_modifiers = always
csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async

# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
Expand Down Expand Up @@ -100,4 +96,28 @@ csharp_preserve_single_line_blocks = true
dotnet_style_require_accessibility_modifiers = always

# Public API
dotnet_diagnostic.RS0016.severity = warning
dotnet_diagnostic.rs0016.severity = warning

# Require braces on all control statements
resharper_braces_for_for = required
resharper_braces_for_foreach = required
resharper_braces_for_ifelse = required
resharper_braces_for_while = required

# ReSharper inspection severities
resharper_arrange_trailing_comma_in_multiline_lists_highlighting = error
resharper_enforce_do_while_statement_braces_highlighting = error
resharper_enforce_fixed_statement_braces_highlighting = error
resharper_enforce_foreach_statement_braces_highlighting = error
resharper_enforce_for_statement_braces_highlighting = error
resharper_enforce_if_statement_braces_highlighting = error
resharper_enforce_lock_statement_braces_highlighting = error
resharper_enforce_using_statement_braces_highlighting = error
resharper_enforce_while_statement_braces_highlighting = error

# ReSharper properties
resharper_align_multiline_binary_expressions_chain = false
resharper_trailing_comma_in_multiline_lists = true
resharper_wrap_before_binary_pattern_op = false
resharper_wrap_chained_binary_expressions = chop_if_long
resharper_wrap_chained_binary_patterns = chop_if_long
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private static (JsonNode Node, JsonElement PathSegment) SelectNodeToPatch(
{
JsonValueKind.String => current[last.Value.GetString()!]!,
JsonValueKind.Number => current[last.Value.GetInt32()]!,
_ => throw new NotSupportedException("Path segment must be int or string.")
_ => throw new NotSupportedException("Path segment must be int or string."),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal sealed class JsonSnapshotValueFormatter : ISnapshotValueFormatter
DateFormatHandling = DateFormatHandling.IsoDateFormat,
Culture = CultureInfo.InvariantCulture,
ContractResolver = ChildFirstContractResolver.Instance,
Converters = new List<JsonConverter> { new StringEnumConverter() }
Converters = new List<JsonConverter> { new StringEnumConverter() },
};

public bool CanHandle(object? value)
Expand Down
4 changes: 2 additions & 2 deletions src/GreenDonut/src/Core/ResultKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ public enum ResultKind
/// <summary>
/// The result is an error.
/// </summary>
Error
}
Error,
}
8 changes: 4 additions & 4 deletions src/GreenDonut/test/Core.Tests/DataLoaderOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void ConstructorAllProps1()
Cache = new TaskCache(1),
Caching = true,
MaxBatchSize = 1,
DiagnosticEvents = new DataLoaderDiagnosticEventListener()
DiagnosticEvents = new DataLoaderDiagnosticEventListener(),
};

// assert
Expand All @@ -34,7 +34,7 @@ public void ConstructorAllProps2()
Cache = null,
Caching = false,
MaxBatchSize = 10,
DiagnosticEvents = null
DiagnosticEvents = null,
};

// assert
Expand Down Expand Up @@ -66,7 +66,7 @@ public void Copy()
Cache = new TaskCache(1),
Caching = true,
MaxBatchSize = 1,
DiagnosticEvents = new DataLoaderDiagnosticEventListener()
DiagnosticEvents = new DataLoaderDiagnosticEventListener(),
};

// act
Expand All @@ -78,4 +78,4 @@ public void Copy()
Assert.Equal(1, copy.MaxBatchSize);
Assert.NotNull(copy.DiagnosticEvents);
}
}
}
12 changes: 6 additions & 6 deletions src/GreenDonut/test/Core.Tests/DataLoaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public async Task LoadSingleResultNoCache()
batchScheduler,
new DataLoaderOptions
{
Caching = false
Caching = false,
});
var key = "Foo";

Expand Down Expand Up @@ -293,7 +293,7 @@ public async Task LoadCollectionResultNoCache()
batchScheduler,
new DataLoaderOptions
{
Caching = false
Caching = false,
});
var keys = new List<string> { "Foo" };

Expand All @@ -314,7 +314,7 @@ public async Task LoadWithNullValues()
{ "Foo", "Bar" },
{ "Bar", null },
{ "Baz", "Foo" },
{ "Qux", null }
{ "Qux", null },
};

ValueTask Fetch(
Expand Down Expand Up @@ -359,7 +359,7 @@ public async Task LoadKeyAndValueCountNotEqual()
{
{ "Foo", "Bar" },
{ "Bar", "Baz" },
{ "Baz", "Foo" }
{ "Baz", "Foo" },
};

ValueTask Fetch(
Expand Down Expand Up @@ -469,7 +469,7 @@ async ValueTask Wait()
var options = new DataLoaderOptions
{
Caching = caching,
MaxBatchSize = batching ? 1 : maxBatchSize
MaxBatchSize = batching ? 1 : maxBatchSize,
};

var batchScheduler = new ManualBatchScheduler();
Expand Down Expand Up @@ -933,4 +933,4 @@ public void IDataLoaderSetTwice()
// assert
Assert.Equal(1, cache.Usage);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void OnCompleteDefinition(ObjectTypeDefinition definition)
EntityResolver,
new List<ReferenceResolverDefinition>
{
Definition.ResolverDefinition.Value
Definition.ResolverDefinition.Value,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace HotChocolate.ApolloFederation;
/// </summary>
public static partial class FederationSchemaPrinter
{
private static readonly HashSet<string> _builtInDirectives = new()
{
private static readonly HashSet<string> _builtInDirectives =
[
WellKnownTypeNames.External,
WellKnownTypeNames.Requires,
WellKnownTypeNames.Provides,
Expand All @@ -25,8 +25,8 @@ public static partial class FederationSchemaPrinter
WellKnownDirectives.Skip,
WellKnownDirectives.Include,
WellKnownDirectives.Deprecated,
SpecifiedByDirectiveType.Names.SpecifiedBy
};
SpecifiedByDirectiveType.Names.SpecifiedBy,
];

/// <summary>
/// Creates a <see cref="string" /> representation of the given
Expand Down Expand Up @@ -99,7 +99,7 @@ private static bool TrySerializeType(
UnionType type => SerializeUnionType(type, context),
EnumType type => SerializeEnumType(type, context),
ScalarType type => SerializeScalarType(type, context),
_ => throw new NotSupportedException()
_ => throw new NotSupportedException(),
};
return definitionNode is not null;
}
Expand All @@ -114,7 +114,7 @@ private static ITypeNode SerializeType(
(INullableTypeNode)SerializeType(nt.Type, context)),
ListType lt => new ListTypeNode(SerializeType(lt.ElementType, context)),
INamedType namedType => SerializeNamedType(namedType, context),
_ => throw new NotSupportedException()
_ => throw new NotSupportedException(),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static bool Matches(
"The entity for the given representation could not be resolved.",
extensions: new Dictionary<string, object?>
{
{ nameof(representation), representation }
{ nameof(representation), representation },
}));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ ... on Product {
{
new ObjectValueNode(
new ObjectFieldNode("__typename", "Product"),
new ObjectFieldNode("id", "apollo-federation"))
}
new ObjectFieldNode("id", "apollo-federation")),
},
});

// assert
Expand Down Expand Up @@ -91,8 +91,8 @@ ... on Product {
new ObjectValueNode(
new ObjectFieldNode("__typename", "Product"),
new ObjectFieldNode("sku", "federation"),
new ObjectFieldNode("package", "@apollo/federation"))
}
new ObjectFieldNode("package", "@apollo/federation")),
},
});

// assert
Expand Down Expand Up @@ -123,8 +123,8 @@ ... on Product {
new ObjectFieldNode("sku", "federation"),
new ObjectFieldNode("variation",
new ObjectValueNode(
new ObjectFieldNode("id", "OSS"))))
}
new ObjectFieldNode("id", "OSS")))),
},
});

// assert
Expand All @@ -146,7 +146,7 @@ public async Task Provides()
}",
new Dictionary<string, object?>
{
["id"] = "apollo-federation"
["id"] = "apollo-federation",
});

// assert
Expand All @@ -168,7 +168,7 @@ public async Task Requires()
}",
new Dictionary<string, object?>
{
["id"] = "apollo-federation"
["id"] = "apollo-federation",
});

// assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ public class Data
public List<Product> Products { get; } = new()
{
new("apollo-federation", "federation", "@apollo/federation", "OSS"),
new("apollo-studio", "studio", string.Empty, "platform")
new("apollo-studio", "studio", string.Empty, "platform"),
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ ... on Product {
{
new ObjectValueNode(
new ObjectFieldNode("__typename", "Product"),
new ObjectFieldNode("id", "apollo-federation"))
}
new ObjectFieldNode("id", "apollo-federation")),
},
});

// assert
Expand Down Expand Up @@ -91,8 +91,8 @@ ... on Product {
new ObjectValueNode(
new ObjectFieldNode("__typename", "Product"),
new ObjectFieldNode("sku", "federation"),
new ObjectFieldNode("package", "@apollo/federation"))
}
new ObjectFieldNode("package", "@apollo/federation")),
},
});

// assert
Expand Down Expand Up @@ -123,8 +123,8 @@ ... on Product {
new ObjectFieldNode("sku", "federation"),
new ObjectFieldNode("variation",
new ObjectValueNode(
new ObjectFieldNode("id", "OSS"))))
}
new ObjectFieldNode("id", "OSS")))),
},
});

// assert
Expand All @@ -146,7 +146,7 @@ public async Task Provides()
}",
new Dictionary<string, object?>
{
["id"] = "apollo-federation"
["id"] = "apollo-federation",
});

// assert
Expand All @@ -168,7 +168,7 @@ public async Task Requires()
}",
new Dictionary<string, object?>
{
["id"] = "apollo-federation"
["id"] = "apollo-federation",
});

// assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ public class Data
public List<Product> Products { get; } = new()
{
new("apollo-federation", "federation", "@apollo/federation", "OSS"),
new("apollo-studio", "studio", string.Empty, "platform")
new("apollo-studio", "studio", string.Empty, "platform"),
};
}
Loading

0 comments on commit 98af61c

Please sign in to comment.