Skip to content

Commit

Permalink
chore: Update ReSharper inspections for Rider/ReSharper 2024.3 (#1364)
Browse files Browse the repository at this point in the history
  • Loading branch information
MWO1024 authored Nov 15, 2024
1 parent c6c19d2 commit 26e4ad3
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,18 @@ resharper_csharp_wrap_parameters_style = chop_if_long
resharper_trailing_comma_in_multiline_lists = true
resharper_wrap_chained_method_calls = chop_if_long
resharper_csharp_wrap_before_binary_opsign = true
# Replicating "csharp_prefer_braces = when_multiline:error" from .NET Code Style
# If we do not explicitly set this, ReSharper/Rider will complain about inconsistent braces and de facto enforce brace everywhere
resharper_braces_for_ifelse = not_required_for_both
resharper_braces_for_dowhile = required_for_multiline_statement
resharper_braces_for_fixed = required_for_multiline_statement
resharper_braces_for_for = required_for_multiline_statement
resharper_braces_for_foreach = required_for_multiline_statement
resharper_braces_for_lock = required_for_multiline_statement
resharper_braces_for_using = required_for_multiline_statement
resharper_braces_for_while = required_for_multiline_statement
# We are removing the inherited "error" setting for "redundant braces"
resharper_braces_redundant = false

##############################################################
# Overrides default configuration #
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ public void CleanupFileStorage(bool disposing = false)
var containers = blobServiceClient.GetBlobContainers();

foreach (var containerToDelete in containers)
{
blobServiceClient.DeleteBlobContainer(containerToDelete.Name);
}

if (disposing)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public async Task Handle(ADayHasPassed notification, CancellationToken cancellat
finally
{
foreach (var scope in serviceScopes)
{
scope.Dispose();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public void CleanupFileStorage(bool disposing = false)
var containers = blobServiceClient.GetBlobContainers();

foreach (var containerToDelete in containers)
{
blobServiceClient.DeleteBlobContainer(containerToDelete.Name);
}

if (disposing)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,17 @@ await _incomingMessagesRequest.ReceiveIncomingMarketMessageAsync(
var archivedMessageAsDictionary = (IDictionary<string, object>)archivedMessage;

foreach (var assertProperty in assertProperties)
{
assertProperty.Value(archivedMessageAsDictionary[assertProperty.Key]);
}

assertProperties.Should()
.HaveSameCount(archivedMessageAsDictionary, "because all archived message properties should be asserted");

foreach (var dbPropertyName in archivedMessageAsDictionary.Keys)
{
assertProperties.Keys.Should().Contain(dbPropertyName);
}
}

protected override void Dispose(bool disposing)
Expand Down
2 changes: 2 additions & 0 deletions source/IntegrationTests/Behaviours/BehavioursTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ protected void ClearDbContextCaches()
.Select(s => (DbContext)_serviceProvider.GetService(s.ServiceType)!);

foreach (var dbContext in dbContextServices)
{
dbContext.ChangeTracker.Clear();
}
}

protected virtual void Dispose(bool disposing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ public async Task InsertFromCsvFileAsync(
{
var row = new string[csvReader.HeaderRecord!.Length];
for (var columnIndex = 0; columnIndex < csvReader.ColumnCount; columnIndex++)
{
row[columnIndex] = ParseColumnValue(schemaInformation, csvReader, columnIndex);
}

rows.Add(row);
}
Expand Down
2 changes: 2 additions & 0 deletions source/IntegrationTests/Fixtures/IntegrationTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ public void CleanupFileStorage(bool disposing = false)
var containers = blobServiceClient.GetBlobContainers();

foreach (var containerToDelete in containers)
{
blobServiceClient.DeleteBlobContainer(containerToDelete.Name);
}

if (disposing)
{
Expand Down
2 changes: 2 additions & 0 deletions source/IntegrationTests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ protected void ClearDbContextCaches()
.Select(s => (DbContext)ServiceProvider.GetService(s.ServiceType)!);

foreach (var dbContext in dbContextServices)
{
dbContext.ChangeTracker.Clear();
}
}

protected virtual void Dispose(bool disposing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ public async Task Given_RetentionCleanUp_When_GridAreaOwnerIsRemoved_Then_AuditL
private async Task AddActorsToDatabaseAsync(List<GridAreaOwnershipAssignedDto> gridAreaOwners)
{
foreach (var gao in gridAreaOwners)
{
await _masterDataClient!.UpdateGridAreaOwnershipAsync(gao, CancellationToken.None);
}
}

private async Task<ActorNumber> GetGridAreaOwnersForGridArea(string gridAreaCode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public void CleanupFileStorage(bool disposing = false)
var containers = blobServiceClient.GetBlobContainers();

foreach (var containerToDelete in containers)
{
blobServiceClient.DeleteBlobContainer(containerToDelete.Name);
}

if (disposing)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,16 @@ public async Task Given_OutgoingMessage_When_MessageIsPeeked_Then_MessageIsArchi
var archivedMessageAsDictionary = (IDictionary<string, object>)archivedMessage;

foreach (var assertProperty in assertProperties)
{
assertProperty.Value(archivedMessageAsDictionary[assertProperty.Key]);
}

assertProperties.Should().HaveSameCount(archivedMessageAsDictionary, "because all archived message properties should be asserted");

foreach (var dbPropertyName in archivedMessageAsDictionary.Keys)
{
assertProperties.Keys.Should().Contain(dbPropertyName);
}
}

private async Task<bool> BundleIsRegistered()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ protected void ClearDbContextCaches()
.Select(s => (DbContext)ServiceProvider.GetService(s.ServiceType)!);

foreach (var dbContext in dbContextServices)
{
dbContext.ChangeTracker.Clear();
}
}

protected virtual void Dispose(bool disposing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public Task<Unit> Handle(InitializeWholesaleServicesProcessesCommand request, Ca
var processes = CreateWholesaleServicesProcesses(request.InitializeWholesaleServicesProcessDto);

foreach (var wholesaleServicesProcess in processes)
{
_wholesaleServicesProcessRepository.Add(wholesaleServicesProcess);
}

return Task.FromResult(Unit.Value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ private static T[][] FastPowerSet<T>(IReadOnlyList<T> seq)
var source = powerSet[j];
var destination = powerSet[count + j] = new T[source.Length + 1];
for (var q = 0; q < source.Length; q++)
{
destination[q] = source[q];
}

destination[source.Length] = cur;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ public AssertEbixDocument HasValueWithAttributes(string xpath, string expectedVa
Assert.Equal(expectedValue, _document.Root?.XPathSelectElement(EnsureXPathHasPrefix(xpath), _xmlNamespaceManager)?.Value);

foreach (var (name, value) in attributes)
{
Assert.Equal(value, _document.Root?.XPathSelectElement(EnsureXPathHasPrefix(xpath), _xmlNamespaceManager)?.Attribute(name)?.Value);
}

return this;
}
Expand Down

0 comments on commit 26e4ad3

Please sign in to comment.