diff --git a/AGENTS.md b/AGENTS.md
index 9518ac1a..0a0fefcf 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -189,3 +189,4 @@ When the user corrects an agent approach, add or tighten one concrete rule here
- When the active log file is owned by `Start-Transcript`, do not call `Add-Content` against that file; write to host output so the transcript captures the line in the same log file without recording a terminating-error diagnostic.
- Log install/uninstall package names and package-manager IDs before queuing background runspace work; do not rely on runspace host output for the package identity.
- Keep performance tracing helpers under `tools/perf`; include them in generated output only through `Compile.ps1 -Trace`.
+- For Script Analyzer cleanup, fix actionable source warnings first and do not globally suppress accepted convention warnings such as plural names, `ShouldProcess` on UI helpers, `$global:sync`, or compile-time cross-file false positives.
diff --git a/functions/private/Invoke-WinUtilISO.ps1 b/functions/private/Invoke-WinUtilISO.ps1
index 5fcf0c68..04f28322 100644
--- a/functions/private/Invoke-WinUtilISO.ps1
+++ b/functions/private/Invoke-WinUtilISO.ps1
@@ -1,12 +1,13 @@
function Write-Win11ISOLog {
param([string]$Message)
$ts = (Get-Date).ToString("HH:mm:ss")
+ $logLine = "[$ts] $Message"
$sync["WPFWin11ISOStatusLog"].Dispatcher.Invoke([action]{
$current = $sync["WPFWin11ISOStatusLog"].Text
if ($current -eq "Ready. Please select a Windows 11 ISO to begin.") {
- $sync["WPFWin11ISOStatusLog"].Text = "[$ts] $Message"
+ $sync["WPFWin11ISOStatusLog"].Text = $logLine
} else {
- $sync["WPFWin11ISOStatusLog"].Text += "`n[$ts] $Message"
+ $sync["WPFWin11ISOStatusLog"].Text += "`n$logLine"
}
$sync["WPFWin11ISOStatusLog"].CaretIndex = $sync["WPFWin11ISOStatusLog"].Text.Length
$sync["WPFWin11ISOStatusLog"].ScrollToEnd()
@@ -293,9 +294,11 @@ function Invoke-WinUtilISOModify {
[scriptblock]$Logger
)
+ $metadataLogger = $Logger
+
function LogMeta([string]$Message) {
- if ($Logger) {
- $null = $Logger.Invoke($Message)
+ if ($metadataLogger) {
+ $null = $metadataLogger.Invoke($Message)
}
}
diff --git a/functions/private/Set-WinUtilProgressbar.ps1 b/functions/private/Set-WinUtilProgressbar.ps1
index 9ea815e2..47097b27 100644
--- a/functions/private/Set-WinUtilProgressbar.ps1
+++ b/functions/private/Set-WinUtilProgressbar.ps1
@@ -14,11 +14,13 @@ function Set-WinUtilProgressbar{
[int]$Percent
)
- Invoke-WPFUIThread -ScriptBlock {$sync.progressBarTextBlock.Text = $label}
- Invoke-WPFUIThread -ScriptBlock {$sync.progressBarTextBlock.ToolTip = $label}
- if ($percent -lt 5 ) {
- $percent = 5 # Ensure the progress bar is not empty, as it looks weird
+ $progressLabel = $Label
+
+ Invoke-WPFUIThread -ScriptBlock {$sync.progressBarTextBlock.Text = $progressLabel}
+ Invoke-WPFUIThread -ScriptBlock {$sync.progressBarTextBlock.ToolTip = $progressLabel}
+ if ($Percent -lt 5 ) {
+ $Percent = 5 # Ensure the progress bar is not empty, as it looks weird
}
- Invoke-WPFUIThread -ScriptBlock { $sync.ProgressBar.Value = $percent}
+ Invoke-WPFUIThread -ScriptBlock { $sync.ProgressBar.Value = $Percent}
}
diff --git a/functions/private/Show-CustomDialog.ps1 b/functions/private/Show-CustomDialog.ps1
index 549e572d..9ae289e6 100644
--- a/functions/private/Show-CustomDialog.ps1
+++ b/functions/private/Show-CustomDialog.ps1
@@ -193,6 +193,7 @@ function Show-CustomDialog {
# Define the Regex to find hyperlinks formatted as HTML tags
$regex = [regex]::new('([^<]+)')
$lastPos = 0
+ $linkHoverBrush = $LinkHoverForegroundColor
# Iterate through each match and add regular text and hyperlinks
foreach ($match in $regex.Matches($Message)) {
@@ -217,7 +218,7 @@ function Show-CustomDialog {
$hyperlink.Add_MouseEnter({
param($eventSender, $routedEvent)
$null = $routedEvent
- $eventSender.Foreground = $LinkHoverForegroundColor
+ $eventSender.Foreground = $linkHoverBrush
$eventSender.FontSize = ($FontSize + ($FontSize / 4))
$eventSender.FontWeight = "SemiBold"
})
diff --git a/functions/private/Show-WPFInstallAppBusy.ps1 b/functions/private/Show-WPFInstallAppBusy.ps1
index 94d0c0f9..20211f79 100644
--- a/functions/private/Show-WPFInstallAppBusy.ps1
+++ b/functions/private/Show-WPFInstallAppBusy.ps1
@@ -10,11 +10,13 @@ function Show-WPFInstallAppBusy {
param (
$text = "Installing apps..."
)
+ $overlayText = $text
+
Invoke-WPFUIThread -ScriptBlock {
$sync.InstallAppAreaOverlay.Visibility = [Windows.Visibility]::Visible
$sync.InstallAppAreaOverlay.Width = $($sync.InstallAppAreaScrollViewer.ActualWidth * 0.4)
$sync.InstallAppAreaOverlay.Height = $($sync.InstallAppAreaScrollViewer.ActualWidth * 0.4)
- $sync.InstallAppAreaOverlayText.Text = $text
+ $sync.InstallAppAreaOverlayText.Text = $overlayText
$sync.InstallAppAreaBorder.IsEnabled = $false
$sync.InstallAppAreaScrollViewer.Effect.Radius = 5
}
diff --git a/lint/PSScriptAnalyser.ps1 b/lint/PSScriptAnalyser.ps1
index 59e51169..47feae83 100644
--- a/lint/PSScriptAnalyser.ps1
+++ b/lint/PSScriptAnalyser.ps1
@@ -21,24 +21,5 @@
# the default rules except for those you exclude below.
# Note: if a rule is in both IncludeRules and ExcludeRules, the rule
# will be excluded.
- ExcludeRules = @(
- # WinUtil is a WPF utility script that intentionally logs progress to the host/transcript.
- 'PSAvoidUsingWriteHost',
-
- # Public and XAML-wired function names are part of the existing WinUtil surface.
- 'PSUseSingularNouns',
- 'PSUseApprovedVerbs',
-
- # UI helpers and internal state helpers are not exposed as WhatIf-capable cmdlets.
- 'PSUseShouldProcessForStateChangingFunctions',
-
- # Shared WPF/runspace state is intentionally stored in $sync/global state.
- 'PSAvoidGlobalVars',
-
- # Source files are UTF-8 without BOM and are verified by parser tests.
- 'PSUseBOMForUnicodeEncodedFile',
-
- # WPF dispatcher closures and Pester mocks intentionally keep callback-style parameters.
- 'PSReviewUnusedParameter'
- )
+ ExcludeRules = @('PSAvoidUsingWriteHost')
}
diff --git a/scripts/start.ps1 b/scripts/start.ps1
index 9d4bfbb2..25e82580 100644
--- a/scripts/start.ps1
+++ b/scripts/start.ps1
@@ -6,7 +6,6 @@
Version : #{replaceme}
#>
-[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'PARAM_OFFLINE', Justification='Consumed after source concatenation by Compile.ps1.')]
param (
[string]$Config,
[ValidateSet("Standard", "Minimal", "Advanced", "")]