Skip to content

Commit 178bde2

Browse files
committed
chore(quality): remove code redundancies across solution
- Bulk-applied via `jb cleanupcode --profile=RemoveRedundancies` then `dotnet format`. Removes redundant argument default values, redundant member initializers, redundant `else` after `return`, redundant anonymous-type property names, and other rewrites in the ReSharper "Remove code redundancies" category — all compiler-equivalent, no behavior change. - Updates `Viper.sln.DotSettings`: the umbrella `<CSRemoveCodeRedundancies>` flag alone is a no-op. ReSharper also requires the (sparsely-documented) sibling `<RemoveCodeRedundancies>` flag plus per-rule sub-flags (`<CSRemoveRedundantArgumentDefaultValues>`, `<CSRemoveRedundantInitializers>`) to actually trigger the rewrites. - Fixes a minor follow-up: `CliniciansController.cs:569` was changed to `clinicians.Count` (List property) from `clinicians.Count()` (LINQ). The IEnumerable to List materialisation in `9823a4c9` made `clinicians` a List, which Sonar S2971 then flagged as preferring the property. No new lint rule violations introduced by this commit.
1 parent 5b9c9dd commit 178bde2

368 files changed

Lines changed: 815 additions & 898 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Viper.sln.DotSettings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=OptimizeUsings/@EntryIndexedValue">&lt;Profile name="OptimizeUsings"&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;/Profile&gt;</s:String>
33
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=ShortenReferences/@EntryIndexedValue">&lt;Profile name="ShortenReferences"&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;/Profile&gt;</s:String>
4-
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=RemoveRedundancies/@EntryIndexedValue">&lt;Profile name="RemoveRedundancies"&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;/Profile&gt;</s:String>
4+
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=RemoveRedundancies/@EntryIndexedValue">&lt;Profile name="RemoveRedundancies"&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;RemoveCodeRedundancies&gt;True&lt;/RemoveCodeRedundancies&gt;&lt;CSRemoveRedundantArgumentDefaultValues&gt;True&lt;/CSRemoveRedundantArgumentDefaultValues&gt;&lt;CSRemoveRedundantInitializers&gt;True&lt;/CSRemoveRedundantInitializers&gt;&lt;/Profile&gt;</s:String>
55
</wpf:ResourceDictionary>

test/CTS/AssessmentControllerTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public async Task CreateStudentEpaCheck()
164164
context.Database.Returns(facadeSub);
165165

166166
var actrlAsFac = GetAssessmentController(SetupUsers.UserType.Faculty);
167-
var newEpa = new CreateUpdateStudentEpa()
167+
var newEpa = new CreateUpdateStudentEpa
168168
{
169169
EncounterDate = DateTime.Now,
170170
Comment = "A comment",
@@ -204,7 +204,7 @@ public async Task UpdateStudentEpaCheck()
204204
var encId1 = SetupAssessments.Encounters.First(e => e.EnteredBy == SetupUsers.facultyUser.AaudUserId).EncounterId;
205205
var encId2 = SetupAssessments.Encounters.First(e => e.EnteredBy != SetupUsers.facultyUser.AaudUserId).EncounterId;
206206

207-
var epa1 = new CreateUpdateStudentEpa()
207+
var epa1 = new CreateUpdateStudentEpa
208208
{
209209
EncounterId = encId1,
210210
EncounterDate = DateTime.Now,
@@ -214,7 +214,7 @@ public async Task UpdateStudentEpaCheck()
214214
ServiceId = 0,
215215
StudentId = SetupUsers.studentUser1.AaudUserId,
216216
};
217-
var epa2 = new CreateUpdateStudentEpa()
217+
var epa2 = new CreateUpdateStudentEpa
218218
{
219219
EncounterId = encId2,
220220
EncounterDate = DateTime.Now,
@@ -224,7 +224,7 @@ public async Task UpdateStudentEpaCheck()
224224
ServiceId = 0,
225225
StudentId = SetupUsers.studentUser1.AaudUserId,
226226
};
227-
var epa3 = new CreateUpdateStudentEpa()
227+
var epa3 = new CreateUpdateStudentEpa
228228
{
229229
EncounterId = 99999,
230230
EncounterDate = DateTime.Now,

test/CTS/CompetencyBundleAssociationControllerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public CompetencyBundleAssociationControllerTest()
112112
public async Task GetCompetencyBundleAssociations_NoFilters_ReturnsOnlyUnbundledCompetencies()
113113
{
114114
// Act
115-
var result = await _controller.GetCompetencyBundleAssociations(null, null, null);
115+
var result = await _controller.GetCompetencyBundleAssociations();
116116

117117
// Assert
118118
var okResult = Assert.IsType<ActionResult<List<CompetencyBundleAssociationDto>>>(result);

test/CTS/SetupAssessments.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,46 @@ namespace Viper.test.CTS
99
{
1010
internal static class SetupAssessments
1111
{
12-
public static readonly List<Encounter> Encounters = new List<Encounter>()
12+
public static readonly List<Encounter> Encounters = new List<Encounter>
1313
{
14-
new Encounter()
14+
new Encounter
1515
{
1616
EncounterId = 1,
1717
EnteredBy = SetupUsers.facultyUser.AaudUserId,
1818
EnteredOn = DateTime.Now,
1919
StudentUserId = SetupUsers.studentUser1.AaudUserId,
2020
EncounterType = (int)EncounterCreationService.EncounterType.Epa,
21-
Student = new Person()
21+
Student = new Person
2222
{
2323
FullName = SetupUsers.studentUser1.DisplayLastName + ", " + SetupUsers.studentUser1.DisplayFirstName,
2424
MailId = "",
2525
},
2626
EnteredByPerson = SetupPeople.GetPeople().Where(p => p.PersonId == SetupUsers.facultyUser.AaudUserId).FirstOrDefault(),
2727
ServiceId = 1,
2828
},
29-
new Encounter()
29+
new Encounter
3030
{
3131
EncounterId = 2,
3232
EnteredBy = SetupUsers.facultyUser.AaudUserId,
3333
EnteredOn = DateTime.Now,
3434
StudentUserId = SetupUsers.studentUser1.AaudUserId,
3535
EncounterType = (int)EncounterCreationService.EncounterType.Epa,
36-
Student = new Person()
36+
Student = new Person
3737
{
3838
FullName = SetupUsers.studentUser1.DisplayLastName + ", " + SetupUsers.studentUser1.DisplayFirstName,
3939
MailId = "",
4040
},
4141
EnteredByPerson = SetupPeople.GetPeople().Where(p => p.PersonId == SetupUsers.facultyUser.AaudUserId).FirstOrDefault(),
4242
ServiceId = 2,
4343
},
44-
new Encounter()
44+
new Encounter
4545
{
4646
EncounterId = 3,
4747
EnteredBy = SetupUsers.otherFacultyUser.AaudUserId,
4848
EnteredOn = DateTime.Now,
4949
StudentUserId = SetupUsers.studentUser2.AaudUserId,
5050
EncounterType = (int)EncounterCreationService.EncounterType.Epa,
51-
Student = new Person()
51+
Student = new Person
5252
{
5353
FullName = SetupUsers.studentUser2.DisplayLastName + ", " + SetupUsers.studentUser2.DisplayFirstName,
5454
MailId = "",
@@ -73,7 +73,7 @@ public static void SetupEncountersTable(VIPERContext context)
7373
.Do(callInfo =>
7474
{
7575
var e = callInfo.Arg<Encounter>();
76-
e.Student = new Person()
76+
e.Student = new Person
7777
{
7878
PersonId = e.StudentUserId,
7979
};

test/ClinicalScheduler/EmailNotificationTest.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public async Task RemoveInstructorScheduleAsync_PrimaryEvaluator_SendsEmailNotif
168168

169169
// Create primary evaluator and another instructor (so removal is allowed)
170170
var primarySchedule = TestDataBuilder.CreateInstructorSchedule(mothraId, rotationId, weekId, true);
171-
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other456", rotationId, weekId, false);
171+
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other456", rotationId, weekId);
172172

173173
await _context.InstructorSchedules.AddRangeAsync(primarySchedule, otherSchedule);
174174
await _context.SaveChangesAsync();
@@ -249,7 +249,7 @@ await _context.Persons.AddAsync(new Person
249249

250250
await _context.SaveChangesAsync();
251251

252-
var schedule = TestDataBuilder.CreateInstructorSchedule("test123", rotationId, weekId, false); // Not primary
252+
var schedule = TestDataBuilder.CreateInstructorSchedule("test123", rotationId, weekId); // Not primary
253253
await _context.InstructorSchedules.AddAsync(schedule);
254254
await _context.SaveChangesAsync();
255255

@@ -323,12 +323,12 @@ public async Task RemoveInstructorScheduleAsync_EmailServiceFails_StillCompletes
323323
var weekId = 10; // Use unique week ID to avoid conflict
324324

325325
await AddTestPersonAsync(mothraId, "John", "Doe");
326-
await AddTestWeekGradYearAsync(weekId, 2025);
326+
await AddTestWeekGradYearAsync(weekId);
327327
await AddTestRotationAsync(rotationId);
328328
await _context.SaveChangesAsync();
329329

330330
var primarySchedule = TestDataBuilder.CreateInstructorSchedule(mothraId, rotationId, weekId, true);
331-
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other456", rotationId, weekId, false);
331+
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other456", rotationId, weekId);
332332

333333
await _context.InstructorSchedules.AddRangeAsync(primarySchedule, otherSchedule);
334334
await _context.SaveChangesAsync();
@@ -429,7 +429,7 @@ await _context.Persons.AddAsync(new Person
429429
await _context.SaveChangesAsync();
430430

431431
var primarySchedule = TestDataBuilder.CreateInstructorSchedule(mothraId, rotationId, weekId, true);
432-
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other456", rotationId, weekId, false);
432+
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other456", rotationId, weekId);
433433

434434
await _context.InstructorSchedules.AddRangeAsync(primarySchedule, otherSchedule);
435435
await _context.SaveChangesAsync();
@@ -506,7 +506,7 @@ public async Task RemoveInstructorScheduleAsync_PrimaryEvaluatorWithMissingWeekD
506506
await _context.SaveChangesAsync();
507507

508508
var primarySchedule = TestDataBuilder.CreateInstructorSchedule(mothraId, rotationId, weekId, true);
509-
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other456", rotationId, weekId, false);
509+
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other456", rotationId, weekId);
510510

511511
await _context.InstructorSchedules.AddRangeAsync(primarySchedule, otherSchedule);
512512
await _context.SaveChangesAsync();
@@ -575,12 +575,12 @@ public async Task RemoveInstructorScheduleAsync_MultipleEmailRecipients_SendsToA
575575
_mockEmailTemplateRenderer);
576576

577577
await AddTestPersonAsync(mothraId, "John", "Doe");
578-
await AddTestWeekGradYearAsync(weekId, 2025);
578+
await AddTestWeekGradYearAsync(weekId);
579579
await AddTestRotationAsync(rotationId, "Oncology", "ONC");
580580
await _context.SaveChangesAsync();
581581

582582
var primarySchedule = TestDataBuilder.CreateInstructorSchedule(mothraId, rotationId, weekId, true);
583-
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other456", rotationId, weekId, false);
583+
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other456", rotationId, weekId);
584584

585585
await _context.InstructorSchedules.AddRangeAsync(primarySchedule, otherSchedule);
586586
await _context.SaveChangesAsync();
@@ -667,7 +667,7 @@ await _context.Persons.AddAsync(new Person
667667

668668
// Create existing primary evaluator and new instructor
669669
var oldPrimarySchedule = TestDataBuilder.CreateInstructorSchedule(oldPrimaryMothraId, rotationId, weekId, true);
670-
var newInstructorSchedule = TestDataBuilder.CreateInstructorSchedule(newPrimaryMothraId, rotationId, weekId, false);
670+
var newInstructorSchedule = TestDataBuilder.CreateInstructorSchedule(newPrimaryMothraId, rotationId, weekId);
671671

672672
await _context.InstructorSchedules.AddRangeAsync(oldPrimarySchedule, newInstructorSchedule);
673673
await _context.SaveChangesAsync();
@@ -803,7 +803,7 @@ await _context.Persons.AddAsync(new Person
803803

804804
// Create primary evaluator and another instructor (so unsetting is allowed)
805805
var primarySchedule = TestDataBuilder.CreateInstructorSchedule(primaryMothraId, rotationId, weekId, true);
806-
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other789", rotationId, weekId, false);
806+
var otherSchedule = TestDataBuilder.CreateInstructorSchedule("other789", rotationId, weekId);
807807

808808
await _context.InstructorSchedules.AddRangeAsync(primarySchedule, otherSchedule);
809809
await _context.SaveChangesAsync();

test/ClinicalScheduler/InstructorScheduleControllerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public InstructorScheduleControllerTest()
5454
);
5555

5656
// Set up HTTP context for the controller
57-
_controller.ControllerContext = new ControllerContext()
57+
_controller.ControllerContext = new ControllerContext
5858
{
5959
HttpContext = new DefaultHttpContext()
6060
};

test/ClinicalScheduler/Integration/ServiceLayerIntegrationTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,9 @@ public async Task ServiceResponses_UseProperDTOStructure()
464464
// Create a simple service response structure for testing
465465
var serviceResponse = new
466466
{
467-
ServiceId = service.ServiceId,
468-
ServiceName = service.ServiceName,
469-
ShortName = service.ShortName,
467+
service.ServiceId,
468+
service.ServiceName,
469+
service.ShortName,
470470
Rotations = new List<RotationDto> { rotation1Dto, rotation2Dto }
471471
};
472472

test/ClinicalScheduler/RotationsControllerTest.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,8 @@ private static IEnumerable<RotationDto> ExtractRotationsFromResult(ActionResult<
203203
var okResult = Assert.IsType<OkObjectResult>(result.Result);
204204
return Assert.IsAssignableFrom<IEnumerable<RotationDto>>(okResult.Value);
205205
}
206-
else
207-
{
208-
return Assert.IsAssignableFrom<IEnumerable<RotationDto>>(result.Value);
209-
}
206+
207+
return Assert.IsAssignableFrom<IEnumerable<RotationDto>>(result.Value);
210208
}
211209

212210
[Fact]

test/ClinicalScheduler/ScheduleAuditServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class ScheduleAuditServiceTest : IDisposable
1313
private readonly ILogger<ScheduleAuditService> _mockLogger;
1414
private readonly ScheduleAuditService _service;
1515
private readonly ClinicalSchedulerContext _context;
16-
private bool _disposed = false;
16+
private bool _disposed;
1717

1818
public ScheduleAuditServiceTest()
1919
{

0 commit comments

Comments
 (0)