Skip to content

Commit

Permalink
Merge branch 'main' into gai/code-spell-check
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib authored Jun 3, 2024
2 parents 8069763 + 5843a9f commit e51d344
Show file tree
Hide file tree
Showing 51 changed files with 376 additions and 178 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ dotnet_style_require_accessibility_modifiers = always

# Public API
dotnet_diagnostic.rs0016.severity = warning
dotnet_diagnostic.rcs1194.severity = none

# Require braces on all control statements
resharper_braces_for_for = required
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI

on:
pull_request_target:
pull_request:
branches:
- main

Expand Down Expand Up @@ -55,15 +55,6 @@ jobs:
echo "::set-output name=src_changes::false"
fi
pr-labeler:
name: Apply Labels
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v5

spellcheck:
name: "Spellcheck Documentation"
runs-on: ubuntu-latest
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Pull Request Labeler

on:
pull_request_target:
branches:
- main

permissions:
contents: read
pull-requests: write

jobs:
pr-labeler:
name: Apply Labels
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@
"*.targets": "xml",
"*.tasks": "xml"
},
"cSpell.words": [
"Nats"
],
"dotnet.defaultSolution": "src/All.sln"
}
41 changes: 36 additions & 5 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,53 @@
}
},
{
"label": "Build entire repository (Debug)",
"label": "Build src/All.sln",
"command": "dotnet",
"type": "shell",
"args": [
"build",
"src/All.sln",
// Ask dotnet build to generate full paths for file names.
"/property:GenerateFullPaths=true",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
"/consoleloggerparameters:NoSummary",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
},
{
"label": "Build src/HotChocolate/Core/HotChocolate.Core.sln",
"command": "dotnet",
"type": "shell",
"args": [
"build",
"src/HotChocolate/Core/HotChocolate.Core.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
},
{
"label": "Test src/All.sln",
"command": "dotnet",
"type": "shell",
"args": [
"test",
"src/All.sln",
"--verbosity q",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
},
]
}
6 changes: 6 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,10 @@
<None Include="$(MSBuildThisFileDirectory)..\LICEN*" Pack="true" PackagePath="" Visible="false" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'debug'">
<PackageReference Include="Roslynator.Analyzers" Version="4.12.3" />
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.3" />
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.12.3" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Threading.Tasks;
using CookieCrumble;
using HotChocolate.ApolloFederation.Types;
Expand Down Expand Up @@ -45,6 +46,7 @@ public class Address
[DirectiveType(DirectiveLocation.FieldDefinition)]
public sealed class Custom;

[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
public sealed class CustomDirectiveAttribute()
: DirectiveAttribute<Custom>(new Custom());
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Microsoft.Extensions.DependencyInjection;

public class ServiceCollectionExtensionTests
public static class ServiceCollectionExtensionTests
{
[Fact]
public static void AddHttpRequestSerializer_OfT()
Expand Down
3 changes: 3 additions & 0 deletions src/HotChocolate/Caching/src/Caching/CacheControlAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public CacheControlAttribute()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="CacheControlAttribute"/> class with the specified maximum age.
/// </summary>
/// <param name="maxAge">
/// The maximum time, in seconds, the resource can be cached.
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace HotChocolate;
/// This attribute can be used by custom diagnostic event listeners
/// to specify the source to which a listener shall be bound to.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class DiagnosticEventSourceAttribute : Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ public interface IExecutionResult : IAsyncDisposable
/// A cleanup task that will be executed when this result is disposed.
/// </param>
void RegisterForCleanup(Func<ValueTask> clean);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static IRequestExecutorBuilder UseExceptions(

public static IRequestExecutorBuilder UseTimeout(
this IRequestExecutorBuilder builder) =>
builder.UseRequest(DocumentParserMiddleware.Create());
builder.UseRequest(TimeoutMiddleware.Create());

public static IRequestExecutorBuilder UseInstrumentation(
this IRequestExecutorBuilder builder) =>
Expand Down
1 change: 0 additions & 1 deletion src/HotChocolate/Core/src/Execution/IRequestExecutor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

namespace HotChocolate.Types;

internal sealed class GetDataLoaderAttribute : Attribute;
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
internal sealed class GetDataLoaderAttribute : Attribute;
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public async ValueTask DisposeAsync()
command.CommandText = $"""UNLISTEN "{_channelName}" """;
await command.ExecuteNonQueryAsync();
}
catch (Exception)
catch
{
// we swallow any exception because we don't care about the connection state
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ private async Task Disconnect(CancellationToken cancellationToken)
{
await _onDisconnect(cancellationToken);
}
catch (Exception)
catch
{
// on disconnect we ignore all exceptions
}

await Connection.DisposeAsync();
}
}
catch (Exception)
catch
{
// on disconnect we ignore all exceptions
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace HotChocolate.Types;
/// <summary>
/// This attribute adds the cursor paging middleware to the annotated method or property.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false)]
public sealed class UsePagingAttribute : DescriptorAttribute
{
private string? _connectionName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void Validate(
EnsureFieldNamesAreValid(inputType, errors);
EnsureOneOfFieldsAreValid(inputType, errors, ref names);
EnsureFieldDeprecationIsValid(inputType, errors);
TryReachCycleRecursively(cycleValidationContext, inputType);
TryReachCycleRecursively(ref cycleValidationContext, inputType);

cycleValidationContext.CycleStartIndex.Clear();
}
Expand All @@ -58,7 +58,7 @@ private ref struct CycleValidationContext

// https://github.com/IvanGoncharov/graphql-js/blob/408bcda9c88df85e039f5d072011b1cb465fe830/src/type/validate.js#L535
private static void TryReachCycleRecursively(
in CycleValidationContext context,
ref CycleValidationContext context,
InputObjectType type)
{
if (!context.Visited.Add(type))
Expand All @@ -85,7 +85,7 @@ private static void TryReachCycleRecursively(
}
else
{
TryReachCycleRecursively(context, inputObjectType);
TryReachCycleRecursively(ref context, inputObjectType);
}
context.FieldPath.Pop();
}
Expand Down
14 changes: 7 additions & 7 deletions src/HotChocolate/Core/src/Types/Types/Scalars/Iso8601Duration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,13 @@ internal static bool TryParse(string s, out TimeSpan? result)
return false;
}

/// Helper method that constructs an integer from leading digits starting at s[offset].
/// "offset" is updated to contain an offset just beyond the last digit.
/// The number of digits consumed is returned in cntDigits.
/// The integer is returned (0 if no digits). If the digits cannot fit into an Int32:
/// 1. If eatDigits is true, then additional digits will be silently discarded
/// (don't count towards numDigits)
/// 2. If eatDigits is false, an overflow exception is thrown
// Helper method that constructs an integer from leading digits starting at s[offset].
// "offset" is updated to contain an offset just beyond the last digit.
// The number of digits consumed is returned in cntDigits.
// The integer is returned (0 if no digits). If the digits cannot fit into an Int32:
// 1. If eatDigits is true, then additional digits will be silently discarded
// (don't count towards numDigits)
// 2. If eatDigits is false, an overflow exception is thrown
private static bool TryParseDigits(string s, ref int offset, bool eatDigits, out int result, out int numDigits)
{
var offsetStart = offset;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);HotChocolate.Execution.Generated</InterceptorsPreviewNamespaces>

<!--EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GeneratedFiles</CompilerGeneratedFilesOutputPath-->
</PropertyGroup>
<PropertyGroup>
<AssemblyName>HotChocolate.Types.Analyzers.Tests</AssemblyName>
<RootNamespace>HotChocolate.Types</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Core\HotChocolate.Core.csproj" />
<ProjectReference Include="..\Utilities\HotChocolate.Tests.Utilities.csproj" />
<ProjectReference Include="..\..\src\Types.Analyzers\HotChocolate.Types.Analyzers.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

<ItemGroup>
<None Update="$(MSBuildProjectDirectory)\__resources__\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="$(MSBuildProjectDirectory)\xunit.runner.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);HotChocolate.Execution.Generated</InterceptorsPreviewNamespaces>

<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GeneratedFiles</CompilerGeneratedFilesOutputPath>
</PropertyGroup>

<PropertyGroup>
<AssemblyName>HotChocolate.Types.Analyzers.Tests</AssemblyName>
<RootNamespace>HotChocolate.Types</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Core\HotChocolate.Core.csproj" />
<ProjectReference Include="..\Utilities\HotChocolate.Tests.Utilities.csproj" />
<ProjectReference Include="..\..\src\Types.Analyzers\HotChocolate.Types.Analyzers.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

<ItemGroup>
<None Update="$(MSBuildProjectDirectory)\__resources__\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="$(MSBuildProjectDirectory)\xunit.runner.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Loading

0 comments on commit e51d344

Please sign in to comment.