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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,6 @@ dotnet_naming_style.end_in_async_style.required_suffix = Async

# dotnet_naming_rule.<namingRuleTitle>.severity = <value>
dotnet_naming_rule.async_methods_end_in_async.severity = warning

# Remove unnecessary import https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0005
dotnet_diagnostic.IDE0005.severity = warning
13 changes: 10 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
- src/**
- .github/workflows/**

env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
test:
strategy:
Expand All @@ -26,9 +30,12 @@ jobs:
- name: Install dependencies
working-directory: src
run: dotnet restore
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
- name: Check formatting
if: ${{ startsWith(matrix.os, 'ubuntu') }}
working-directory: src
run: |
dotnet tool install -g dotnet-format --version 5.0.205101 --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
dotnet format --check -v diag --fix-style warn --fix-analyzers warn || (echo "Run 'dotnet format' to fix formatting issues" && exit 1)
- name: Build solution [Release]
working-directory: src
run: dotnet build --no-restore -c Release
Expand Down
20 changes: 15 additions & 5 deletions src/GraphQLParser.ApiTests/ApiApprovalTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using PublicApiGenerator;
using Shouldly;
using Xunit;
Expand All @@ -6,13 +7,22 @@ namespace GraphQLParser.ApiTests
{
public class ApiApprovalTests
{
[Fact]
public void Public_Api_Should_Not_Change_Inadvertently()
[Theory]
[InlineData(typeof(Lexer))]
public void Public_Api_Should_Not_Change_Inadvertently(Type type)
{
typeof(Lexer).Assembly.GeneratePublicApi(new ApiGeneratorOptions
string publicApi = type.Assembly.GeneratePublicApi(new ApiGeneratorOptions
{
IncludeAssemblyAttributes = false
}).ShouldMatchApproved();
IncludeAssemblyAttributes = false,
//WhitelistedNamespacePrefixes = new[] { "Microsoft.Extensions.DependencyInjection" },
ExcludeAttributes = new[] { "System.Diagnostics.DebuggerDisplayAttribute" }
});

// See: https://shouldly.readthedocs.io/en/latest/assertions/shouldMatchApproved.html
// Note: If the AssemblyName.approved.txt file doesn't match the latest publicApi value,
// this call will try to launch a diff tool to help you out but that can fail on
// your machine if a diff tool isn't configured/setup.
publicApi.ShouldMatchApproved(options => options.WithFilenameGenerator((testMethodInfo, discriminator, fileType, fileExtension) => $"{type.Assembly.GetName().Name}.{fileType}.{fileExtension}"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ namespace GraphQLParser.AST
public System.Collections.Generic.List<GraphQLParser.AST.GraphQLValue>? Values { get; set; }
public override string ToString() { }
}
[System.Diagnostics.DebuggerDisplay("(Start={Start}, End={End})")]
public readonly struct GraphQLLocation : System.IEquatable<GraphQLParser.AST.GraphQLLocation>
{
public GraphQLLocation(int start, int end) { }
Expand All @@ -183,7 +182,6 @@ namespace GraphQLParser.AST
public override int GetHashCode() { }
public override string ToString() { }
}
[System.Diagnostics.DebuggerDisplay("{Value}")]
public class GraphQLName : GraphQLParser.AST.ASTNode
{
public GraphQLName() { }
Expand Down
1 change: 0 additions & 1 deletion src/GraphQLParser.Tests/Validation/LexerValidationTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using GraphQLParser.Exceptions;
using Shouldly;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using GraphQLParser.Exceptions;
using Shouldly;
using Xunit;
Expand Down
9 changes: 0 additions & 9 deletions src/GraphQLParser/LexerContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,5 @@ private void ValidateCharacterCode(int code)
$"Invalid character \"\\u{code.ToString("D4")}\".", _source, _currentIndex);
}
}

private int WaitForEndOfComment(string body, int position, char code)
{
while (++position < body.Length && (code = body[position]) != 0 && (code > 0x001F || code == 0x0009) && code != 0x000A && code != 0x000D)
{
}

return position;
}
}
}