Skip to content

Commit 4b9c42b

Browse files
committed
Copilot review fixes
1 parent d33bbe8 commit 4b9c42b

4 files changed

Lines changed: 23 additions & 23 deletions

File tree

Calendar/CalLogHelpers/CalLogCSVFunctions.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ function Write-UnknownTimestampDiagnostics {
343343
}
344344
}
345345

346-
function Get-SortedCalendarDiagnosticObjectsByTimestamp {
346+
function SortCalendarDiagnosticObjectsByTimestamp {
347347
param(
348348
[array]$CalLogs
349349
)
@@ -355,7 +355,7 @@ function Get-SortedCalendarDiagnosticObjectsByTimestamp {
355355
return @($CalLogs | Sort-Object @{ Expression = { Get-CalendarLogTimestampSortValue $_.LogTimestamp } })
356356
}
357357

358-
function Get-SortedEnhancedCalendarLogsByTimestamp {
358+
function SortEnhancedCalendarLogsByTimestamp {
359359
param(
360360
[array]$CalLogs
361361
)
@@ -367,7 +367,7 @@ function Get-SortedEnhancedCalendarLogsByTimestamp {
367367
return @($CalLogs | Sort-Object @{ Expression = { Get-CalendarLogTimestampSortValue $_.LogTimestamp } })
368368
}
369369

370-
function Get-SortedCalendarDiagnosticObjects {
370+
function SortCalendarDiagnosticObjects {
371371
param(
372372
[array]$CalLogs
373373
)
@@ -383,11 +383,11 @@ function Get-SortedCalendarDiagnosticObjects {
383383
@{ Expression = { Get-CalendarLogOriginalStartDateSortValue $_.OriginalStartDate } })
384384
} catch {
385385
Write-Warning "Secondary raw log sort failed; falling back to LogTimestamp-only sorting. $_"
386-
return Get-SortedCalendarDiagnosticObjectsByTimestamp -CalLogs $CalLogs
386+
return SortCalendarDiagnosticObjectsByTimestamp -CalLogs $CalLogs
387387
}
388388
}
389389

390-
function Get-SortedEnhancedCalendarLogs {
390+
function SortEnhancedCalendarLogs {
391391
param(
392392
[array]$CalLogs
393393
)
@@ -447,7 +447,7 @@ function Get-SortedEnhancedCalendarLogs {
447447
return @($sortedLogs)
448448
} catch {
449449
Write-Warning "Secondary enhanced log sort failed; falling back to LogTimestamp-only sorting. $_"
450-
return Get-SortedEnhancedCalendarLogsByTimestamp -CalLogs $CalLogs
450+
return SortEnhancedCalendarLogsByTimestamp -CalLogs $CalLogs
451451
}
452452
}
453453

@@ -580,7 +580,7 @@ Builds the CSV output from the Calendar Diagnostic Objects
580580
function BuildCSV {
581581

582582
Write-Host "Starting to Process Calendar Logs..."
583-
$script:GCDO = Remove-DuplicateCalendarDiagnosticObjects -CalLogs $script:GCDO
583+
$script:GCDO = RemoveDuplicateCalendarDiagnosticObjects -CalLogs $script:GCDO
584584
$rawNullCount = @($script:GCDO).Count - @($script:GCDO | Where-Object { $null -ne $_ }).Count
585585
if ($rawNullCount -gt 0) {
586586
Write-Host -ForegroundColor Yellow "Removed [$rawNullCount] null raw calendar log row(s) before processing."
@@ -660,7 +660,7 @@ function BuildCSV {
660660
[void](Test-LogTimestampOrder -Entries $GCDOResults -Name 'Enhanced Tab before sorting' -ValuePropertyName 'LogTimestamp')
661661
Write-UnknownTimestampDiagnostics -Entries $GCDOResults -Name 'Enhanced Tab before sorting' -ValuePropertyName 'LogTimestamp'
662662
# Keep RAW output in collected order; only the Enhanced projection is re-sorted for display and Timeline generation.
663-
$script:EnhancedCalLogs = Get-SortedEnhancedCalendarLogs -CalLogs $GCDOResults
663+
$script:EnhancedCalLogs = SortEnhancedCalendarLogs -CalLogs $GCDOResults
664664
[void](Test-LogTimestampOrder -Entries $script:GCDO -Name 'RAW Tab' -ValuePropertyName 'LogTimestamp')
665665

666666
Write-Host -ForegroundColor Green "Calendar Logs have been processed, Exporting logs to file..."

Calendar/CalLogHelpers/ExceptionCollectionFunctions.ps1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) Microsoft Corporation.
1+
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

44
function Read-UInt16LE {
@@ -65,7 +65,7 @@ function Convert-AppointmentRecurrenceBlobToBytes {
6565
)
6666

6767
if ($AppointmentRecurrenceBlob -is [byte[]]) {
68-
return ,$AppointmentRecurrenceBlob
68+
return , $AppointmentRecurrenceBlob
6969
}
7070

7171
$blobText = [string]$AppointmentRecurrenceBlob
@@ -83,7 +83,7 @@ function Convert-AppointmentRecurrenceBlobToBytes {
8383
$bytes[$index / 2] = [Convert]::ToByte($blobText.Substring($index, 2), 16)
8484
}
8585

86-
return ,$bytes
86+
return , $bytes
8787
}
8888

8989
function Get-RecentExceptionCutoff {
@@ -121,7 +121,7 @@ function Get-CalendarDiagnosticObjectDeduplicationKey {
121121
return "$itemId|$calendarLogRequestId|$logTimestamp|$originalStartDate|$triggerAction|$itemClass|$itemVersion|$logRowType|$responsibleUserName|$clientInfo"
122122
}
123123

124-
function Remove-DuplicateCalendarDiagnosticObjects {
124+
function RemoveDuplicateCalendarDiagnosticObjects {
125125
param(
126126
[array]$CalLogs,
127127
[switch]$Quiet
@@ -150,10 +150,10 @@ function Merge-CalendarDiagnosticObjects {
150150
)
151151

152152
$combinedLogs = @($BaseLogs) + @($AdditionalLogs)
153-
return Remove-DuplicateCalendarDiagnosticObjects -CalLogs $combinedLogs -Quiet
153+
return RemoveDuplicateCalendarDiagnosticObjects -CalLogs $combinedLogs -Quiet
154154
}
155155

156-
function Filter-ExceptionLogsByRecency {
156+
function FilterExceptionLogsByRecency {
157157
param(
158158
[array]$ExceptionLogs
159159
)
@@ -279,7 +279,7 @@ function Get-ExceptionDatesFromMostRecentAppointmentBlob {
279279
}
280280
}
281281

282-
function Collect-ExceptionLogsLegacy {
282+
function CollectExceptionLogsLegacy {
283283
param(
284284
[string]$Identity,
285285
[string]$MeetingID,
@@ -309,7 +309,7 @@ function Collect-ExceptionLogsLegacy {
309309
$cutoffDate = Get-RecentExceptionCutoff
310310
if ($null -ne $cutoffDate) {
311311
Write-Host -ForegroundColor Yellow "Filtering legacy Exception logs to only keep items with OriginalStartDate in the last 6 months."
312-
$ExceptionLogs = Filter-ExceptionLogsByRecency -ExceptionLogs $ExceptionLogs
312+
$ExceptionLogs = FilterExceptionLogsByRecency -ExceptionLogs $ExceptionLogs
313313
}
314314

315315
Write-Host -ForegroundColor Cyan "Found $($ExceptionLogs.count) Exception Logs, adding them into the CalLogs."
@@ -321,7 +321,7 @@ function Collect-ExceptionLogsLegacy {
321321
}
322322
}
323323

324-
function Collect-ExceptionLogsFast {
324+
function CollectExceptionLogsFast {
325325
param(
326326
[string]$Identity,
327327
[string]$MeetingID
@@ -360,7 +360,7 @@ function Collect-ExceptionLogsFast {
360360
$script:ExceptionCollectionStatus = "CollectedFast"
361361
}
362362

363-
function Collect-ExceptionLogs {
363+
function CollectExceptionLogs {
364364
param(
365365
[string]$Identity,
366366
[string]$MeetingID
@@ -373,16 +373,16 @@ function Collect-ExceptionLogs {
373373
if ($IsRecurring) {
374374
if ($FastExceptions.IsPresent -and [string]::IsNullOrEmpty($ExceptionDate)) {
375375
try {
376-
Collect-ExceptionLogsFast -Identity $Identity -MeetingID $MeetingID
376+
CollectExceptionLogsFast -Identity $Identity -MeetingID $MeetingID
377377
} catch {
378378
$script:ExceptionCollectionStatus = "CollectedLegacyFallback"
379379
Write-DashLineBoxColor "FAST EXCEPTION COLLECTION FAILED",
380380
"Error: $($_.Exception.Message)",
381381
"Falling back to the legacy per-appointment Exception collector." -Color Red -DashChar "="
382-
Collect-ExceptionLogsLegacy -Identity $Identity -MeetingID $MeetingID -UsedAsFallback
382+
CollectExceptionLogsLegacy -Identity $Identity -MeetingID $MeetingID -UsedAsFallback
383383
}
384384
} else {
385-
Collect-ExceptionLogsLegacy -Identity $Identity -MeetingID $MeetingID
385+
CollectExceptionLogsLegacy -Identity $Identity -MeetingID $MeetingID
386386
}
387387
} else {
388388
$script:ExceptionCollectionStatus = "NotRecurring"

Calendar/CalLogHelpers/Invoke-GetCalLogs.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function GetCalLogsWithSubject {
183183
$script:GCDO = $InitialCDOs; # use the CalLogs that we already have, since there is only one.
184184
if ($Exceptions.IsPresent -and [string]::IsNullOrEmpty($ExceptionDate)) {
185185
Write-Host -ForegroundColor Yellow "Subject search resolved to one MeetingID [$($script:SubjectResolvedMeetingId)]. Collecting Exceptions by default."
186-
Collect-ExceptionLogs -Identity $Identity -MeetingID $script:SubjectResolvedMeetingId
186+
CollectExceptionLogs -Identity $Identity -MeetingID $script:SubjectResolvedMeetingId
187187
} elseif (-not [string]::IsNullOrEmpty($ExceptionDate)) {
188188
$script:ExceptionCollectionStatus = "SkippedUntilMeetingIdChosen"
189189
Write-Host -ForegroundColor Yellow "Subject search resolved to one MeetingID [$($script:SubjectResolvedMeetingId)], but -ExceptionDate requires rerunning with -MeetingID for targeted Exception collection."

Calendar/Get-CalendarDiagnosticObjectsSummary.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ if (-not ([string]::IsNullOrEmpty($Subject)) ) {
287287
}
288288

289289
if ($Exceptions.IsPresent) {
290-
Collect-ExceptionLogs -Identity $ID -MeetingID $MeetingID
290+
CollectExceptionLogs -Identity $ID -MeetingID $MeetingID
291291
}
292292

293293
BuildCSV

0 commit comments

Comments
 (0)