Skip to content

Commit e86f3d1

Browse files
author
github-actions
committed
Updated code formatting to match rules in .editorconfig
1 parent 3829e52 commit e86f3d1

6 files changed

Lines changed: 94 additions & 94 deletions

File tree

src/Hyperbee.Expressions.Lab/FetchExpression.cs

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ public FetchExpression(
2424
Expression content = null,
2525
Expression clientName = null )
2626
{
27-
ArgumentNullException.ThrowIfNull( url, nameof(url) );
28-
ArgumentNullException.ThrowIfNull( method, nameof(method) );
27+
ArgumentNullException.ThrowIfNull( url, nameof( url ) );
28+
ArgumentNullException.ThrowIfNull( method, nameof( method ) );
2929

30-
if ( url.Type != typeof(string) )
31-
throw new ArgumentException( "Url must be of type string.", nameof(url) );
30+
if ( url.Type != typeof( string ) )
31+
throw new ArgumentException( "Url must be of type string.", nameof( url ) );
3232

33-
if ( method.Type != typeof(HttpMethod) )
34-
throw new ArgumentException( "Method must be of type HttpMethod.", nameof(method) );
33+
if ( method.Type != typeof( HttpMethod ) )
34+
throw new ArgumentException( "Method must be of type HttpMethod.", nameof( method ) );
3535

36-
if ( headers != null && headers.Type != typeof(Dictionary<string, string>) )
37-
throw new ArgumentException( "Headers must be of type Dictionary<string, string>.", nameof(headers) );
36+
if ( headers != null && headers.Type != typeof( Dictionary<string, string> ) )
37+
throw new ArgumentException( "Headers must be of type Dictionary<string, string>.", nameof( headers ) );
3838

3939
Url = url;
4040
Method = method;
@@ -43,36 +43,36 @@ public FetchExpression(
4343
ClientName = clientName;
4444
}
4545

46-
public override Type Type => typeof(Task<HttpResponseMessage>);
46+
public override Type Type => typeof( Task<HttpResponseMessage> );
4747
public override ExpressionType NodeType => ExpressionType.Extension;
4848
public override bool CanReduce => true;
4949

5050
private static readonly ConstructorInfo RequestConstructorInfo = typeof( HttpRequestMessage ).GetConstructor( [typeof( HttpMethod ), typeof( string )] );
5151

5252
public override Expression Reduce()
5353
{
54-
if (_serviceProvider == null)
55-
throw new InvalidOperationException("IServiceProvider has not been set.");
54+
if ( _serviceProvider == null )
55+
throw new InvalidOperationException( "IServiceProvider has not been set." );
5656

5757
// Create service provider constant
58-
var providerConst = Constant(_serviceProvider);
58+
var providerConst = Constant( _serviceProvider );
5959

6060
Expression resolveHttpClient;
6161

62-
if (ClientName != null)
62+
if ( ClientName != null )
6363
{
6464
// Resolve IHttpClientFactory and call CreateClient(name)
6565
var getFactory = Call(
66-
typeof(ServiceProviderServiceExtensions),
67-
nameof(ServiceProviderServiceExtensions.GetRequiredService),
68-
[typeof(IHttpClientFactory)],
66+
typeof( ServiceProviderServiceExtensions ),
67+
nameof( ServiceProviderServiceExtensions.GetRequiredService ),
68+
[typeof( IHttpClientFactory )],
6969
providerConst
7070
);
7171

72-
var factoryVar = Variable(typeof(IHttpClientFactory), "factory");
72+
var factoryVar = Variable( typeof( IHttpClientFactory ), "factory" );
7373

74-
var assignFactory = Assign(factoryVar, getFactory);
75-
var createClient = Call(factoryVar, nameof(IHttpClientFactory.CreateClient), null, ClientName);
74+
var assignFactory = Assign( factoryVar, getFactory );
75+
var createClient = Call( factoryVar, nameof( IHttpClientFactory.CreateClient ), null, ClientName );
7676

7777
resolveHttpClient = Block(
7878
[factoryVar],
@@ -84,25 +84,25 @@ public override Expression Reduce()
8484
{
8585
// Resolve HttpClient directly
8686
resolveHttpClient = Call(
87-
typeof(ServiceProviderServiceExtensions),
88-
nameof(ServiceProviderServiceExtensions.GetRequiredService),
89-
[typeof(HttpClient)],
87+
typeof( ServiceProviderServiceExtensions ),
88+
nameof( ServiceProviderServiceExtensions.GetRequiredService ),
89+
[typeof( HttpClient )],
9090
providerConst
9191
);
9292
}
9393

94-
var clientVar = Variable(typeof(HttpClient), "client");
95-
var assignClient = Assign(clientVar, resolveHttpClient);
94+
var clientVar = Variable( typeof( HttpClient ), "client" );
95+
var assignClient = Assign( clientVar, resolveHttpClient );
9696

9797
// Create HttpRequestMessage
98-
var requestVar = Variable(typeof(HttpRequestMessage), "request");
99-
98+
var requestVar = Variable( typeof( HttpRequestMessage ), "request" );
99+
100100
var requestCtor = New(
101101
RequestConstructorInfo,
102102
Method,
103103
Url
104104
);
105-
var assignRequest = Assign(requestVar, requestCtor);
105+
var assignRequest = Assign( requestVar, requestCtor );
106106

107107
var variables = new List<ParameterExpression> { clientVar, requestVar };
108108
var block = new List<Expression> {
@@ -111,55 +111,55 @@ public override Expression Reduce()
111111
};
112112

113113
// Optional headers
114-
if (Headers != null)
114+
if ( Headers != null )
115115
{
116116
var headersVar = Variable( typeof( Dictionary<string, string> ), "headers" );
117117
variables.Add( headersVar );
118-
block.Add(Assign(headersVar, Headers));
118+
block.Add( Assign( headersVar, Headers ) );
119119

120-
var kvp = Parameter(typeof(KeyValuePair<string, string>), "kvp");
120+
var kvp = Parameter( typeof( KeyValuePair<string, string> ), "kvp" );
121121

122122
var addHeader = Call(
123-
Property(requestVar, nameof(HttpRequestMessage.Headers)),
124-
nameof(HttpRequestHeaders.Add),
123+
Property( requestVar, nameof( HttpRequestMessage.Headers ) ),
124+
nameof( HttpRequestHeaders.Add ),
125125
null,
126-
Property(kvp, nameof(KeyValuePair<string, string>.Key)),
127-
Property(kvp, nameof(KeyValuePair<string, string>.Value))
126+
Property( kvp, nameof( KeyValuePair<string, string>.Key ) ),
127+
Property( kvp, nameof( KeyValuePair<string, string>.Value ) )
128128
);
129129

130-
block.Add(ForEach(headersVar, kvp, addHeader));
130+
block.Add( ForEach( headersVar, kvp, addHeader ) );
131131
}
132132

133133
// Optional content
134-
if (Content != null)
134+
if ( Content != null )
135135
{
136-
block.Add(Assign(
137-
Property(requestVar, nameof(HttpRequestMessage.Content)),
136+
block.Add( Assign(
137+
Property( requestVar, nameof( HttpRequestMessage.Content ) ),
138138
Content
139-
));
139+
) );
140140
}
141141

142142
// SendAsync call
143-
var sendCall = Call(clientVar, nameof(HttpClient.SendAsync), null, requestVar);
143+
var sendCall = Call( clientVar, nameof( HttpClient.SendAsync ), null, requestVar );
144144

145145
return Block(
146146
variables,
147-
block.Append(sendCall)
147+
block.Append( sendCall )
148148
);
149149
}
150150

151-
public void SetServiceProvider(IServiceProvider serviceProvider)
151+
public void SetServiceProvider( IServiceProvider serviceProvider )
152152
{
153153
_serviceProvider = serviceProvider;
154154
}
155155

156-
protected override Expression VisitChildren(ExpressionVisitor visitor)
156+
protected override Expression VisitChildren( ExpressionVisitor visitor )
157157
{
158158
return new FetchExpression(
159-
visitor.Visit(Url),
160-
visitor.Visit(Method),
161-
Headers != null ? visitor.Visit(Headers) : null,
162-
Content != null ? visitor.Visit(Content) : null,
159+
visitor.Visit( Url ),
160+
visitor.Visit( Method ),
161+
Headers != null ? visitor.Visit( Headers ) : null,
162+
Content != null ? visitor.Visit( Content ) : null,
163163
ClientName
164164
);
165165
}
@@ -173,6 +173,6 @@ public static FetchExpression Fetch( Expression clientName,
173173
Expression content = null,
174174
Expression headers = null )
175175
{
176-
return new FetchExpression(url, method, headers, content, clientName);
176+
return new FetchExpression( url, method, headers, content, clientName );
177177
}
178178
}

src/Hyperbee.Expressions.Lab/JsonExpression.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,26 @@ public JsonExpression( Expression inputExpression, Type targetType )
2525
public override Expression Reduce()
2626
{
2727
var optionExpression = (Expression) (_serviceProvider?
28-
.GetService( typeof(JsonSerializerOptions) ) is not JsonSerializerOptions options
29-
? Default( typeof(JsonSerializerOptions) )
28+
.GetService( typeof( JsonSerializerOptions ) ) is not JsonSerializerOptions options
29+
? Default( typeof( JsonSerializerOptions ) )
3030
: Constant( options ));
3131

32-
if ( InputExpression.Type == typeof(string) )
32+
if ( InputExpression.Type == typeof( string ) )
3333
{
3434
// Deserialize from a string
3535
return Call(
36-
typeof(JsonSerializer),
37-
nameof(JsonSerializer.Deserialize),
36+
typeof( JsonSerializer ),
37+
nameof( JsonSerializer.Deserialize ),
3838
[TargetType],
3939
InputExpression,
4040
optionExpression
4141
);
4242
}
4343

44-
if ( InputExpression.Type == typeof(Stream) )
44+
if ( InputExpression.Type == typeof( Stream ) )
4545
{
46-
var deserializeAsyncMethodInfo = typeof(JsonSerializer)
47-
.GetMethod( nameof(JsonSerializer.DeserializeAsync), [
46+
var deserializeAsyncMethodInfo = typeof( JsonSerializer )
47+
.GetMethod( nameof( JsonSerializer.DeserializeAsync ), [
4848
typeof(Stream),
4949
typeof(JsonSerializerOptions),
5050
typeof(CancellationToken)
@@ -59,10 +59,10 @@ public override Expression Reduce()
5959
) );
6060
}
6161

62-
if ( InputExpression.Type == typeof(HttpContent) )
62+
if ( InputExpression.Type == typeof( HttpContent ) )
6363
{
64-
var readStreamMethodInfo = typeof(HttpContent)
65-
.GetMethod( nameof(HttpContent.ReadAsStreamAsync), Type.EmptyTypes )!;
64+
var readStreamMethodInfo = typeof( HttpContent )
65+
.GetMethod( nameof( HttpContent.ReadAsStreamAsync ), Type.EmptyTypes )!;
6666

6767
// Deserialize from HttpContent using the stream
6868
var readStreamAsync = Await(
@@ -72,8 +72,8 @@ public override Expression Reduce()
7272
)
7373
);
7474

75-
var deserializeAsyncMethodInfo = typeof(JsonSerializer)
76-
.GetMethod( nameof(JsonSerializer.DeserializeAsync), [
75+
var deserializeAsyncMethodInfo = typeof( JsonSerializer )
76+
.GetMethod( nameof( JsonSerializer.DeserializeAsync ), [
7777
typeof(Stream),
7878
typeof(JsonSerializerOptions),
7979
typeof(CancellationToken)
@@ -84,7 +84,7 @@ public override Expression Reduce()
8484
deserializeAsyncMethodInfo,
8585
readStreamAsync,
8686
optionExpression,
87-
Default( typeof(CancellationToken) )
87+
Default( typeof( CancellationToken ) )
8888
) );
8989
}
9090

@@ -96,8 +96,8 @@ protected override Expression VisitChildren( ExpressionVisitor visitor )
9696
{
9797
var newInput = visitor.Visit( InputExpression );
9898

99-
return newInput == InputExpression
100-
? this
99+
return newInput == InputExpression
100+
? this
101101
: new JsonExpression( newInput, TargetType );
102102
}
103103

@@ -111,6 +111,6 @@ public static partial class ExpressionExtensions
111111
{
112112
public static JsonExpression Json( Expression inputExpression, Type targetType = null )
113113
{
114-
return new JsonExpression( inputExpression, targetType ?? typeof(JsonElement) );
114+
return new JsonExpression( inputExpression, targetType ?? typeof( JsonElement ) );
115115
}
116116
}

src/Hyperbee.Expressions.Lab/JsonPathExpression.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ public class JsonPathExpression : Expression
1212

1313
public JsonPathExpression( Expression jsonExpression, Expression path )
1414
{
15-
if ( jsonExpression.Type != typeof(JsonElement) && jsonExpression.Type != typeof(JsonNode) )
15+
if ( jsonExpression.Type != typeof( JsonElement ) && jsonExpression.Type != typeof( JsonNode ) )
1616
throw new InvalidOperationException( "Only JsonElement and JsonNode types are supported." );
1717

1818
JsonExpression = jsonExpression;
1919
Path = path;
2020
}
2121

22-
public override Type Type => typeof(IEnumerable<>).MakeGenericType( JsonExpression.Type );
22+
public override Type Type => typeof( IEnumerable<> ).MakeGenericType( JsonExpression.Type );
2323
public override ExpressionType NodeType => ExpressionType.Extension;
2424
public override bool CanReduce => true;
2525

2626
public override Expression Reduce()
2727
{
28-
var delegateType = typeof(NodeProcessorDelegate<>).MakeGenericType( JsonExpression.Type );
29-
var selectMethodInfo = typeof(JsonPath<>)
28+
var delegateType = typeof( NodeProcessorDelegate<> ).MakeGenericType( JsonExpression.Type );
29+
var selectMethodInfo = typeof( JsonPath<> )
3030
.MakeGenericType( JsonExpression.Type )
3131
.GetMethod(
3232
"Select",

src/Hyperbee.Expressions/UsingExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public override Expression Reduce()
4242

4343
protected override Expression VisitChildren( ExpressionVisitor visitor )
4444
{
45-
var newDisposeVariable = DisposeVariable != null
45+
var newDisposeVariable = DisposeVariable != null
4646
? visitor.VisitAndConvert( DisposeVariable, nameof( VisitChildren ) )
4747
: null;
4848

0 commit comments

Comments
 (0)