Skip to content

Commit 883e07b

Browse files
committed
Fixed R# warning: use string.Empty
1 parent 93c6b0d commit 883e07b

7 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public async Task InvokeAsync(HttpContext httpContext, IJsonApiRequest request)
9898
if (CodeTimingSessionManager.IsEnabled && _logger.IsEnabled(LogLevel.Information))
9999
{
100100
string timingResults = CodeTimingSessionManager.Current.GetResults();
101-
string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, "");
101+
string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, string.Empty);
102102
string requestUrl = httpContext.Request.GetEncodedUrl();
103103
LogMeasurement(requestMethod, requestUrl, Environment.NewLine, timingResults);
104104
}

src/JsonApiDotNetCore/Queries/Expressions/SortExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public override string ToString()
4848

4949
public override string ToFullString()
5050
{
51-
return $"{string.Join(',', Elements.Select(child => child.ToFullString()))}{(IsAutoGenerated ? " (auto-generated)" : "")}";
51+
return $"{string.Join(',', Elements.Select(child => child.ToFullString()))}{(IsAutoGenerated ? " (auto-generated)" : string.Empty)}";
5252
}
5353

5454
public override bool Equals(object? obj)

src/JsonApiDotNetCore/Serialization/Request/JsonApiReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public JsonApiReader(IJsonApiOptions options, IDocumentAdapter documentAdapter,
4242

4343
if (_logger.IsEnabled(LogLevel.Trace))
4444
{
45-
string requestMethod = httpRequest.Method.Replace(Environment.NewLine, "");
45+
string requestMethod = httpRequest.Method.Replace(Environment.NewLine, string.Empty);
4646
string requestUrl = httpRequest.GetEncodedUrl();
4747
LogRequest(requestMethod, requestUrl, requestBody);
4848
}

src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task WriteAsync(object? model, HttpContext httpContext)
6565

6666
if (_logger.IsEnabled(LogLevel.Trace))
6767
{
68-
string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, "");
68+
string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, string.Empty);
6969
string requestUrl = httpContext.Request.GetEncodedUrl();
7070
LogResponse(requestMethod, requestUrl, responseBody, httpContext.Response.StatusCode);
7171
}

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,10 @@ public async Task Can_sort_on_multiple_fields_in_multiple_scopes()
312312
blogs[0].Posts[1].Caption = "A";
313313
blogs[0].Posts[2].Caption = "A";
314314
blogs[0].Posts[3].Caption = "C";
315-
blogs[0].Posts[0].Url = "";
315+
blogs[0].Posts[0].Url = string.Empty;
316316
blogs[0].Posts[1].Url = "www.some2.com";
317317
blogs[0].Posts[2].Url = "www.some1.com";
318-
blogs[0].Posts[3].Url = "";
318+
blogs[0].Posts[3].Url = string.Empty;
319319

320320
blogs[0].Posts[0].Comments = _fakers.Comment.GenerateSet(3);
321321
blogs[0].Posts[0].Comments.ElementAt(0).CreatedAt = 1.January(2015).AsUtc();

test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public void Reader_Read_Pagination_Succeeds(string? pageNumber, string? pageSize
182182
ResourceFieldChainExpression?[] scopeTrees = constraints.Select(expressionInScope => expressionInScope.Scope).ToArray();
183183

184184
scopeTrees.Should().HaveSameCount(scopeTreesExpectedArray);
185-
scopeTrees.Select(tree => tree?.ToString() ?? "").Should().BeEquivalentTo(scopeTreesExpectedArray, options => options.WithStrictOrdering());
185+
scopeTrees.Select(tree => tree?.ToString() ?? string.Empty).Should().BeEquivalentTo(scopeTreesExpectedArray, options => options.WithStrictOrdering());
186186

187187
string[] valueTreesExpectedArray = valueTreesExpected.Split("|");
188188
QueryExpression[] valueTrees = constraints.Select(expressionInScope => expressionInScope.Expression).ToArray();

test/TestBuildingBlocks/XUnitLoggerProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private static string GetLogLevelString(LogLevel logLevel)
145145
LogLevel.Warning => "WARN",
146146
LogLevel.Error => "FAIL",
147147
LogLevel.Critical => "CRIT",
148-
LogLevel.None => "",
148+
LogLevel.None => string.Empty,
149149
_ => throw new ArgumentOutOfRangeException(nameof(logLevel))
150150
};
151151
}

0 commit comments

Comments
 (0)