Skip to content

Commit 19032f3

Browse files
refactor: remove redundant string interpolations
This PR replaces all instances of interpolated strings that contain no expressions with plain string literals. By eliminating empty interpolations, we reduce unnecessary allocations and improve code readability. - Empty interpolated string: DeepSource identified multiple occurrences of strings wrapped in `$"..."` without any embedded variables. Such empty interpolations add needless overhead and offer no benefit. All flagged instances (including calls to Console.WriteLine, this.WriteTrace, this.WriteError, and results.Add) have been converted to regular string literals. > This Autofix was generated by AI. Please review the change before merging.
1 parent a09124e commit 19032f3

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

TransactionProcessing.SchedulerService/DataGenerator/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static async Task Main(string[] args){
4141
baseAddressFunc = (apiName) => {
4242
String ipaddress = "192.168.1.163";
4343

44-
if (apiName == "SecurityService"){
44+
if (apiName == "SecurityService"){
4545
return $"https://{ipaddress}:5001";
4646
}
4747

@@ -51,11 +51,11 @@ static async Task Main(string[] args){
5151
//return $"http://127.0.0.1:5002";
5252
}
5353

54-
if (apiName == "FileProcessorApi"){
54+
if (apiName == "FileProcessorApi"){
5555
return $"http://{ipaddress}:5009";
5656
}
5757

58-
if (apiName == "TestHostApi"){
58+
if (apiName == "TestHostApi"){
5959
return $"http://{ipaddress}:9000";
6060
}
6161

@@ -89,7 +89,7 @@ static async Task Main(string[] args){
8989
await Program.GenerateTransactions(g, estateId, cancellationToken);
9090
//await Program.GenerateStatements(g, estateId, cancellationToken);
9191

92-
Console.WriteLine($"Process Complete");
92+
Console.WriteLine("Process Complete");
9393
}
9494

9595
private static async Task GenerateStatements(ITransactionDataGeneratorService g, Guid estateId, CancellationToken cancellationToken){

TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.DataGenerator/TransactionDataGeneratorService.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ public async Task<Result<MerchantResponse>> GetMerchant(Guid estateId,
637637
return result;
638638
}
639639

640-
this.WriteTrace($"Merchant retrieved successfully");
640+
this.WriteTrace("Merchant retrieved successfully");
641641

642642
return result;
643643
}
@@ -709,15 +709,15 @@ private async Task<Result> SendFloatDepositRequest(Guid estateId,
709709
Result<String> tokenResult = await this.GetAuthToken(cancellationToken);
710710
if (tokenResult.IsFailed)
711711
return ResultHelpers.CreateFailure(tokenResult);
712-
this.WriteTrace($"About to Float Credit Request");
712+
this.WriteTrace("About to Float Credit Request");
713713
Result? result = await this.TransactionProcessorClient.RecordFloatCreditPurchase(tokenResult.Data, estateId, request, cancellationToken);
714714
if (result.IsFailed) {
715-
this.WriteError($"Error Float Credit Request");
715+
this.WriteError("Error Float Credit Request");
716716
this.WriteError(result.Message);
717717
return result;
718718
}
719719

720-
this.WriteTrace($"Float Credit Request sent");
720+
this.WriteTrace("Float Credit Request sent");
721721

722722
return Result.Success();
723723
}
@@ -782,10 +782,10 @@ private async Task<Result<SerialisedMessage>> SendSaleTransaction(MerchantRespon
782782
private readonly String ClientToken;
783783

784784
private async Task<Result<String>> GetAuthToken(CancellationToken cancellationToken) {
785-
this.WriteTrace($"About to get auth token");
785+
this.WriteTrace("About to get auth token");
786786

787787
if (this.TokenResponse == null) {
788-
this.WriteTrace($"TokenResponse was null");
788+
this.WriteTrace("TokenResponse was null");
789789
Result<TokenResponse> tokenResult = await this.SecurityServiceClient.GetToken(this.ClientId, this.ClientSecret, cancellationToken);
790790

791791
if (tokenResult.IsFailed)
@@ -794,14 +794,14 @@ private async Task<Result<String>> GetAuthToken(CancellationToken cancellationTo
794794
}
795795

796796
if (this.TokenResponse.Expires.UtcDateTime.Subtract(DateTime.UtcNow) < TimeSpan.FromMinutes(2)) {
797-
this.WriteTrace($"TokenResponse was expired");
797+
this.WriteTrace("TokenResponse was expired");
798798
Result<TokenResponse> tokenResult = await this.SecurityServiceClient.GetToken(this.ClientId, this.ClientSecret, cancellationToken);
799799
if (tokenResult.IsFailed)
800800
return ResultHelpers.CreateFailure(tokenResult);
801801
this.TokenResponse = tokenResult.Data;
802802
}
803803

804-
this.WriteTrace($"Auth token retrieved");
804+
this.WriteTrace("Auth token retrieved");
805805

806806
return Result.Success<String>(this.TokenResponse.AccessToken);
807807
}

TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.Jobs/Jobs/Jobs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static async Task<Result> GenerateFloatCredits(ITransactionDataGeneratorS
9595
// Get all the contracts up front
9696
Result<List<ContractResponse>> contractsResult = await t.GetEstateContracts(config.EstateId, cancellationToken);
9797
if (contractsResult.IsFailed) {
98-
results.Add($"Error getting Contract List");
98+
results.Add("Error getting Contract List");
9999
return Result.Failure($"Error making float credits for [{string.Join(",", results)}]");
100100
}
101101

0 commit comments

Comments
 (0)