Skip to content

Commit bc0c327

Browse files
committed
fix: resolve warning-level code quality findings
1 parent dcb03f6 commit bc0c327

2 files changed

Lines changed: 19 additions & 16 deletions

File tree

ColDogLocker.Cli/Commands/LockerCommands.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -444,32 +444,29 @@ public static int List(string[] args)
444444
LockerService.LoadLockers();
445445

446446
// Check for filter flags
447-
bool? filterLocked = null;
448-
if (args.Contains("--locked"))
449-
{
450-
filterLocked = true;
451-
}
452-
else if (args.Contains("--unlocked"))
453-
{
454-
filterLocked = false;
455-
}
447+
var showLocked = args.Contains("--locked");
448+
var showUnlocked = !showLocked && args.Contains("--unlocked");
456449

457450
// Apply filter
458451
var lockers = LockerService.GetLockersSnapshot().AsEnumerable();
459-
if (filterLocked.HasValue)
452+
if (showLocked)
453+
{
454+
lockers = lockers.Where(l => l.IsLocked);
455+
}
456+
else if (showUnlocked)
460457
{
461-
lockers = lockers.Where(l => l.IsLocked == filterLocked.Value);
458+
lockers = lockers.Where(l => !l.IsLocked);
462459
}
463460

464461
var lockerList = lockers.OrderBy(l => l.LockerName).ToList();
465462

466463
if (lockerList.Count == 0)
467464
{
468-
if (filterLocked is true)
465+
if (showLocked)
469466
{
470467
Console.WriteLine("No locked lockers found.");
471468
}
472-
else if (filterLocked is false)
469+
else if (showUnlocked)
473470
{
474471
Console.WriteLine("No unlocked lockers found.");
475472
}

ColDogLocker.Services.Tests/Updates/UpdateServiceTests.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,16 @@ protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage reques
674674
return Task.FromResult(response);
675675
}
676676

677-
return Task.FromResult(new HttpResponseMessage(HttpStatusCode.NotFound)
677+
return Task.FromResult(CreateNotFoundResponse(request, path));
678+
}
679+
680+
private static HttpResponseMessage CreateNotFoundResponse(HttpRequestMessage request, string path)
681+
{
682+
return new HttpResponseMessage(HttpStatusCode.NotFound)
678683
{
679-
RequestMessage = request, Content = new StringContent($"No stubbed response for {path}")
680-
});
684+
RequestMessage = request,
685+
Content = new StringContent($"No stubbed response for {path}")
686+
};
681687
}
682688
}
683689
}

0 commit comments

Comments
 (0)