Skip to content

Commit

Permalink
Empty type termination using semicolon
Browse files Browse the repository at this point in the history
  • Loading branch information
glen-84 committed Nov 26, 2023
1 parent a090dab commit a85b6af
Show file tree
Hide file tree
Showing 33 changed files with 53 additions and 60 deletions.
2 changes: 1 addition & 1 deletion src/CookieCrumble/src/CookieCrumble/LocalFactDiscoverer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace CookieCrumble;

[XunitTestCaseDiscoverer("LocalFactDiscoverer", "YourTestAssemblyName")]
public class LocalFactAttribute : FactAttribute { }
public class LocalFactAttribute : FactAttribute;

public class LocalFactDiscoverer : FactDiscoverer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ namespace HotChocolate;
/// </summary>
[Obsolete("Use [Service(ServiceKind.Pooled)] or [Service(ServiceKind.Resolver)]")]
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class ScopedServiceAttribute : Attribute { }
public sealed class ScopedServiceAttribute : Attribute;
2 changes: 1 addition & 1 deletion src/HotChocolate/Core/src/Abstractions/Types/IInputType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ namespace HotChocolate.Types;
///
/// Spec: https://spec.graphql.org/draft/#sec-Input-and-Output-Types
/// </summary>
public interface IInputType : IType, IHasRuntimeType { }
public interface IInputType : IType, IHasRuntimeType;
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ namespace HotChocolate.Types;
/// This marker interface identifies member of the type system like
/// types, directives, the schema or fields and arguments.
/// </summary>
public interface ITypeSystemMember { }
public interface ITypeSystemMember;
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ public interface IRequestExecutorOptionsAccessor
: IErrorHandlerOptionsAccessor
, IRequestTimeoutOptionsAccessor
, IComplexityAnalyzerOptionsAccessor
, IPersistedQueryOptionsAccessor
{ }
, IPersistedQueryOptionsAccessor;
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,4 @@ private static T CreateDataLoader<T>(IServiceProvider services)
}
}

internal sealed class GetDataLoaderAttribute : Attribute { }
internal sealed class GetDataLoaderAttribute : Attribute;
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ namespace HotChocolate.Subscriptions.Diagnostics;
/// and they will all be notified in the registration order.
/// </summary>
/// <seealso cref="SubscriptionDiagnosticEventsListener"/>
public interface ISubscriptionDiagnosticEventsListener : ISubscriptionDiagnosticEvents { }
public interface ISubscriptionDiagnosticEventsListener : ISubscriptionDiagnosticEvents;
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ namespace HotChocolate.Types.Relay;
/// This attribute marks the node resolver in a relay node type.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public sealed class NodeResolverAttribute : Attribute { }
public sealed class NodeResolverAttribute : Attribute;
Original file line number Diff line number Diff line change
Expand Up @@ -2689,13 +2689,13 @@ void Error()
Assert.Throws<ArgumentException>(Error);
}

public class ErrorObj1 { }
public class ErrorObj1;

public class ErrorObj2 { }
public class ErrorObj2;

public class ErrorObj3 { }
public class ErrorObj3;

public class ErrorObj4 { }
public class ErrorObj4;

public class ErrorObj5 { }
public class ErrorObj5;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ public sealed record Street(string? Value) : ICityOrStreet;
public sealed record City(string? Value) : ICityOrStreet;

[UnionType]
public interface ICityOrStreet { }
public interface ICityOrStreet;

[Node]
[ExtendObjectType<Street>]
Expand Down Expand Up @@ -1090,7 +1090,7 @@ public ValueTask<AuthorizeResult> AuthorizeAsync(
}

[DirectiveType(DirectiveLocation.Object)]
public sealed class FooDirective { }
public sealed class FooDirective;

public sealed class FooDirectiveAttribute : ObjectTypeDescriptorAttribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ private sealed record Street(string? Value) : ICityOrStreet;

private sealed record City(string? Value) : ICityOrStreet;

private interface ICityOrStreet { }
private interface ICityOrStreet;

private sealed class AuthHandler : IAuthorizationHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public IError OnError(IError error)
}
}

public class SomeService { }
public class SomeService;

public class AggregateErrorFilter : IErrorFilter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,5 @@ protected override void Configure(IDirectiveTypeDescriptor<Resolve> descriptor)
}
}

public sealed class Resolve { }
public sealed class Resolve;
}
4 changes: 2 additions & 2 deletions src/HotChocolate/Core/test/Types.Analyzers.Tests/SomeQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ public static Task<string> GetGenericById(
}
}

public class SomeService { }
public class SomeService;

public class GenericService<T> { }
public class GenericService<T>;
Original file line number Diff line number Diff line change
Expand Up @@ -288,5 +288,5 @@ public class QueryWithInferError2
public string Foo(IMyArg o) => throw new NotImplementedException();
}

public interface IMyArg { }
public interface IMyArg;
}
Original file line number Diff line number Diff line change
Expand Up @@ -619,5 +619,5 @@ public class Nullability

#nullable disable

public class Foo { }
public class Foo;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1527,9 +1527,9 @@ public string SetLocalState(
}
}

public class Entity { }
public class Entity;

public class MyService { }
public class MyService;

public class QueryWithScopedExpressionBuilder
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2264,7 +2264,7 @@ protected override void Configure(ISchemaTypeDescriptor descriptor)
}
}

public class MyEnumType : EnumType { }
public class MyEnumType : EnumType;

public class QueryWithIntField
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ public enum Foo
Bar2
}

public class Bar { }
public class Bar;

public enum FooObsolete
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ protected override void Configure(
}
}

public class FooDirective { }
public class FooDirective;

public class QueryType : ObjectType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2267,8 +2267,7 @@ public class FooWithDict
}

public class MyList
: MyListBase
{ }
: MyListBase;

public class MyListBase
: IQueryable<Bar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public void UnionTypeAttribute_Infer_Union()
}

[SetName]
public interface IUnion1 { }
public interface IUnion1;

public class Foo : IUnion1 { }
public class Foo : IUnion1;

public class SetNameAttribute : UnionTypeDescriptorAttribute
{
Expand All @@ -54,8 +54,8 @@ protected override void OnConfigure(
}

[UnionType(Name = "Union")]
public interface IUnion2 { }
public interface IUnion2;

[ObjectType(Name = "Type")]
public class Union2Type1 : IUnion2 { }
public class Union2Type1 : IUnion2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,5 @@ protected override void Configure(
}
}

public class FooDirective { }
public class FooDirective;
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public class IgnoreTest
public string Name { get; set; } = default!;
}

public class ShouldNotBeVisible : SortInputType { }
public class ShouldNotBeVisible : SortInputType;

public class IgnoreTestSortInputType : SortInputType<IgnoreTest>
{
Expand All @@ -267,7 +267,7 @@ protected override void Configure(IDirectiveTypeDescriptor<FooDirective> descrip
}
}

public class FooDirective { }
public class FooDirective;

public class Foo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ namespace HotChocolate.Fusion.Composition.Features;
/// <summary>
/// Defines a feature of the composition process.
/// </summary>
public interface IFusionFeature { }
public interface IFusionFeature;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace HotChocolate.Language;

public interface ISyntaxNodeVisitor { }
public interface ISyntaxNodeVisitor;
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class FooNullable
public bool? Bar { get; set; }
}

public class FooFilterInput : FilterInputType<Foo> { }
public class FooFilterInput : FilterInputType<Foo>;

public class FooNullableFilterInput : FilterInputType<FooNullable> { }
public class FooNullableFilterInput : FilterInputType<FooNullable>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ public class FooNullable
public short? BarShort { get; set; }
}

public class FooFilterInput : FilterInputType<Foo> { }
public class FooFilterInput : FilterInputType<Foo>;

public class FooNullableFilterInput : FilterInputType<FooNullable> { }
public class FooNullableFilterInput : FilterInputType<FooNullable>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ which was the next relevant call down "down the stack" in the error traces which
}
}

private interface IService { }
private interface IService;

private sealed class ServiceA : IService { }
private sealed class ServiceA : IService;

private sealed class ServiceB : IService { }
private sealed class ServiceB : IService;

private sealed class ServiceC : IService { }
private sealed class ServiceC : IService;
}
15 changes: 5 additions & 10 deletions src/Nullable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ namespace System.Diagnostics.CodeAnalysis;
#else
public
#endif
sealed class AllowNullAttribute : Attribute
{ }
sealed class AllowNullAttribute : Attribute;

/// <summary>Specifies that null is disallowed as an input even if the corresponding type allows it.</summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)]
Expand All @@ -26,8 +25,7 @@ sealed class AllowNullAttribute : Attribute
#else
public
#endif
sealed class DisallowNullAttribute : Attribute
{ }
sealed class DisallowNullAttribute : Attribute;

/// <summary>Specifies that an output may be null even if the corresponding type disallows it.</summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)]
Expand All @@ -36,8 +34,7 @@ sealed class DisallowNullAttribute : Attribute
#else
public
#endif
sealed class MaybeNullAttribute : Attribute
{ }
sealed class MaybeNullAttribute : Attribute;

/// <summary>Specifies that an output will not be null even if the corresponding type allows it.</summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)]
Expand All @@ -46,8 +43,7 @@ sealed class MaybeNullAttribute : Attribute
#else
public
#endif
sealed class NotNullAttribute : Attribute
{ }
sealed class NotNullAttribute : Attribute;

/// <summary>Specifies that when a method returns <see cref="ReturnValue"/>, the parameter may be null even if the corresponding type disallows it.</summary>
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
Expand Down Expand Up @@ -113,8 +109,7 @@ sealed class NotNullIfNotNullAttribute : Attribute
#else
public
#endif
sealed class DoesNotReturnAttribute : Attribute
{ }
sealed class DoesNotReturnAttribute : Attribute;

/// <summary>Specifies that the method will not return if the associated Boolean parameter is passed the specified value.</summary>
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace StrawberryShake.CodeGeneration.CSharp.Builders;

public interface ICode : ICodeBuilder { }
public interface ICode : ICodeBuilder;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace StrawberryShake.CodeGeneration.CSharp.Builders;

public interface ITypeBuilder : ICodeBuilder { }
public interface ITypeBuilder : ICodeBuilder;
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ public void Uri_Type() =>
"extend schema @key(fields: \"id\")");
}

public class Custom { }
public class Custom;

0 comments on commit a85b6af

Please sign in to comment.