mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 17:41:14 +10:00
Align analyzer warning cleanup policy
This commit is contained in:
@@ -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.
|
- 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.
|
- 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`.
|
- 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.
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
function Write-Win11ISOLog {
|
function Write-Win11ISOLog {
|
||||||
param([string]$Message)
|
param([string]$Message)
|
||||||
$ts = (Get-Date).ToString("HH:mm:ss")
|
$ts = (Get-Date).ToString("HH:mm:ss")
|
||||||
|
$logLine = "[$ts] $Message"
|
||||||
$sync["WPFWin11ISOStatusLog"].Dispatcher.Invoke([action]{
|
$sync["WPFWin11ISOStatusLog"].Dispatcher.Invoke([action]{
|
||||||
$current = $sync["WPFWin11ISOStatusLog"].Text
|
$current = $sync["WPFWin11ISOStatusLog"].Text
|
||||||
if ($current -eq "Ready. Please select a Windows 11 ISO to begin.") {
|
if ($current -eq "Ready. Please select a Windows 11 ISO to begin.") {
|
||||||
$sync["WPFWin11ISOStatusLog"].Text = "[$ts] $Message"
|
$sync["WPFWin11ISOStatusLog"].Text = $logLine
|
||||||
} else {
|
} else {
|
||||||
$sync["WPFWin11ISOStatusLog"].Text += "`n[$ts] $Message"
|
$sync["WPFWin11ISOStatusLog"].Text += "`n$logLine"
|
||||||
}
|
}
|
||||||
$sync["WPFWin11ISOStatusLog"].CaretIndex = $sync["WPFWin11ISOStatusLog"].Text.Length
|
$sync["WPFWin11ISOStatusLog"].CaretIndex = $sync["WPFWin11ISOStatusLog"].Text.Length
|
||||||
$sync["WPFWin11ISOStatusLog"].ScrollToEnd()
|
$sync["WPFWin11ISOStatusLog"].ScrollToEnd()
|
||||||
@@ -293,9 +294,11 @@ function Invoke-WinUtilISOModify {
|
|||||||
[scriptblock]$Logger
|
[scriptblock]$Logger
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$metadataLogger = $Logger
|
||||||
|
|
||||||
function LogMeta([string]$Message) {
|
function LogMeta([string]$Message) {
|
||||||
if ($Logger) {
|
if ($metadataLogger) {
|
||||||
$null = $Logger.Invoke($Message)
|
$null = $metadataLogger.Invoke($Message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ function Set-WinUtilProgressbar{
|
|||||||
[int]$Percent
|
[int]$Percent
|
||||||
)
|
)
|
||||||
|
|
||||||
Invoke-WPFUIThread -ScriptBlock {$sync.progressBarTextBlock.Text = $label}
|
$progressLabel = $Label
|
||||||
Invoke-WPFUIThread -ScriptBlock {$sync.progressBarTextBlock.ToolTip = $label}
|
|
||||||
if ($percent -lt 5 ) {
|
Invoke-WPFUIThread -ScriptBlock {$sync.progressBarTextBlock.Text = $progressLabel}
|
||||||
$percent = 5 # Ensure the progress bar is not empty, as it looks weird
|
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}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ function Show-CustomDialog {
|
|||||||
# Define the Regex to find hyperlinks formatted as HTML <a> tags
|
# Define the Regex to find hyperlinks formatted as HTML <a> tags
|
||||||
$regex = [regex]::new('<a href="([^"]+)">([^<]+)</a>')
|
$regex = [regex]::new('<a href="([^"]+)">([^<]+)</a>')
|
||||||
$lastPos = 0
|
$lastPos = 0
|
||||||
|
$linkHoverBrush = $LinkHoverForegroundColor
|
||||||
|
|
||||||
# Iterate through each match and add regular text and hyperlinks
|
# Iterate through each match and add regular text and hyperlinks
|
||||||
foreach ($match in $regex.Matches($Message)) {
|
foreach ($match in $regex.Matches($Message)) {
|
||||||
@@ -217,7 +218,7 @@ function Show-CustomDialog {
|
|||||||
$hyperlink.Add_MouseEnter({
|
$hyperlink.Add_MouseEnter({
|
||||||
param($eventSender, $routedEvent)
|
param($eventSender, $routedEvent)
|
||||||
$null = $routedEvent
|
$null = $routedEvent
|
||||||
$eventSender.Foreground = $LinkHoverForegroundColor
|
$eventSender.Foreground = $linkHoverBrush
|
||||||
$eventSender.FontSize = ($FontSize + ($FontSize / 4))
|
$eventSender.FontSize = ($FontSize + ($FontSize / 4))
|
||||||
$eventSender.FontWeight = "SemiBold"
|
$eventSender.FontWeight = "SemiBold"
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ function Show-WPFInstallAppBusy {
|
|||||||
param (
|
param (
|
||||||
$text = "Installing apps..."
|
$text = "Installing apps..."
|
||||||
)
|
)
|
||||||
|
$overlayText = $text
|
||||||
|
|
||||||
Invoke-WPFUIThread -ScriptBlock {
|
Invoke-WPFUIThread -ScriptBlock {
|
||||||
$sync.InstallAppAreaOverlay.Visibility = [Windows.Visibility]::Visible
|
$sync.InstallAppAreaOverlay.Visibility = [Windows.Visibility]::Visible
|
||||||
$sync.InstallAppAreaOverlay.Width = $($sync.InstallAppAreaScrollViewer.ActualWidth * 0.4)
|
$sync.InstallAppAreaOverlay.Width = $($sync.InstallAppAreaScrollViewer.ActualWidth * 0.4)
|
||||||
$sync.InstallAppAreaOverlay.Height = $($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.InstallAppAreaBorder.IsEnabled = $false
|
||||||
$sync.InstallAppAreaScrollViewer.Effect.Radius = 5
|
$sync.InstallAppAreaScrollViewer.Effect.Radius = 5
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,24 +21,5 @@
|
|||||||
# the default rules except for those you exclude below.
|
# the default rules except for those you exclude below.
|
||||||
# Note: if a rule is in both IncludeRules and ExcludeRules, the rule
|
# Note: if a rule is in both IncludeRules and ExcludeRules, the rule
|
||||||
# will be excluded.
|
# will be excluded.
|
||||||
ExcludeRules = @(
|
ExcludeRules = @('PSAvoidUsingWriteHost')
|
||||||
# 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'
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
Version : #{replaceme}
|
Version : #{replaceme}
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'PARAM_OFFLINE', Justification='Consumed after source concatenation by Compile.ps1.')]
|
|
||||||
param (
|
param (
|
||||||
[string]$Config,
|
[string]$Config,
|
||||||
[ValidateSet("Standard", "Minimal", "Advanced", "")]
|
[ValidateSet("Standard", "Minimal", "Advanced", "")]
|
||||||
|
|||||||
Reference in New Issue
Block a user