Repository: microsoft/CSS-Exchange
File: PublicFolders/ValidateEXOPFDumpster.ps1 (PowerShell)

Code before:
        }
    }
}
function ExtractLog {
    param([PSCustomObject]$PublicFolderInfo)
    #create zip file for logs folder
    if (!(Test-Path  "$ExportPath\logs_$ts")) {
        mkdir "$ExportPath\logs_$ts" -Force | Out-Null
    }
    $PublicFolderInfo | Export-Clixml -Path "$ExportPath\logs_$ts\PublicFolderInfo$($PublicFolderInfo.PublicFolder.Name).xml"
}
function AskForFeedback {
    Write-Host "Please rate the script experience & tell us what you liked or what we can do better over https://aka.ms/PFDumpsterFeedback!" -ForegroundColor Cyan
    "Please rate the script experience & tell us what you liked or what we can do better over https://aka.ms/PFDumpsterFeedback!" | Out-File $ExportPath\$Script:ReportName -Append
}
function QuitEXOSession {
    if ($null -eq $SessionCheck) {
        try {
            Write-Host "Quitting EXO PowerShell session..." -ForegroundColor Yellow
            Disconnect-ExchangeOnline -ErrorAction Stop -Confirm:$false
            $CurrentDescription= "Disconnecting from EXO"
            $CurrentStatus = "Success"
            LogError -CurrentStatus $CurrentStatus -Function "Disconnecting from EXO" -CurrentDescription $CurrentDescription
            Write-Host "`nOutput was exported in the following location: $ExportPath" -ForegroundColor Yellow
            Start-Sleep -Seconds 3
            break
        } catch {
            $ErrorEncountered=$Global:error[0].Exception
            $CurrentDescription = "Disconnecting from EXO"
            $CurrentStatus = "Failure"
            LogError -CurrentStatus $CurrentStatus -Function "Disconnecting from EXO" -CurrentDescription $CurrentDescription
            Write-Host "Error encountered during executing the script!"-ForegroundColor Red
            Write-Host $ErrorEncountered -ForegroundColor Red
            Write-Host "`nOutput was exported in the following location: $ExportPath" -ForegroundColor Yellow
            Start-Sleep -Seconds 3
            break
        }
    }
}
#Intro
$ts = Get-Date -Format yyyyMMdd_HHmmss
Write-Host $ExportPath
if ($null -eq $ExportPath -or $ExportPath -eq "") {
    $ExportPath = "$env:USERPROFILE\Desktop\ValidatePFDumpster\ValidatePFDumpster_$ts"
    mkdir $ExportPath -Force | Out-Null
} else {
    if (!(Test-Path -Path $ExportPath)) {
        Write-Host "The specified folder location $ExportPath is not existing, please re-run the script and ensure to enter a valid path or leave the ExportPath unassigned" -ForegroundColor Red
        exit
    } else {
        $ExportPath = "$ExportPath\ValidatePFDumpster\ValidatePFDumpster_$ts"

Review comment (suggestion):
Not sure what the intent of this `break` is here, but this isn't correct use of it. 

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_break?view=powershell-7.3#do-not-use-break-outside-of-a-loop-switch-or-trap

Code after:
            WriteToScreenAndLog -Issue $Issue -Fix $Fix
        }
    }
}
function ExtractLog {
    param([PSCustomObject]$PublicFolderInfo)
    #create zip file for logs folder
    if (!(Test-Path  "$ExportPath\logs_$ts")) {
        mkdir "$ExportPath\logs_$ts" -Force | Out-Null
    }
    $PublicFolderInfo | Export-Clixml -Path "$ExportPath\logs_$ts\PublicFolderInfo$($PublicFolderInfo.PublicFolder.Name).xml"
}
function AskForFeedback {
    $Feedback="Please rate the script experience & tell us what you liked or what we can do better over https://aka.ms/PFDumpsterFeedback!"
    Write-Host $Feedback -ForegroundColor Cyan
    $Feedback | Out-File $ExportPath\$Script:ReportName -Append
}
function QuitEXOSession {
    if ($null -eq $SessionCheck) {
        try {
            Write-Host "Quitting EXO PowerShell session..." -ForegroundColor Yellow
            Disconnect-ExchangeOnline -ErrorAction Stop -Confirm:$false
            $CurrentDescription= "Disconnecting from EXO"
            $CurrentStatus = "Success"
            LogError -CurrentStatus $CurrentStatus -Function "Disconnecting from EXO" -CurrentDescription $CurrentDescription
            Write-Host "`nOutput was exported in the following location: $ExportPath" -ForegroundColor Yellow
            Start-Sleep -Seconds 3
            exit
        } catch {
            $ErrorEncountered=$Global:error[0].Exception
            $CurrentDescription = "Disconnecting from EXO"
            $CurrentStatus = "Failure"
            LogError -CurrentStatus $CurrentStatus -Function "Disconnecting from EXO" -CurrentDescription $CurrentDescription
            Write-Host "Error encountered during executing the script!"-ForegroundColor Red
            Write-Host $ErrorEncountered -ForegroundColor Red
            Write-Host "`nOutput was exported in the following location: $ExportPath" -ForegroundColor Yellow
            Start-Sleep -Seconds 3
            exit
        }
    }
}
#Intro
$ts = Get-Date -Format yyyyMMdd_HHmmss
Write-Host $ExportPath
if ($null -eq $ExportPath -or $ExportPath -eq "") {
    $ExportPath = "$env:USERPROFILE\Desktop\ValidatePFDumpster\ValidatePFDumpster_$ts"
    mkdir $ExportPath -Force | Out-Null
} else {
    if (!(Test-Path -Path $ExportPath)) {
        Write-Host "The specified folder location $ExportPath is not existing, please re-run the script and ensure to enter a valid path or leave the ExportPath unassigned" -ForegroundColor Red
        exit