mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-07-15 16:38:00 +00: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.
|
||||
- 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.
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
}
|
||||
|
||||
@@ -193,6 +193,7 @@ function Show-CustomDialog {
|
||||
# Define the Regex to find hyperlinks formatted as HTML <a> tags
|
||||
$regex = [regex]::new('<a href="([^"]+)">([^<]+)</a>')
|
||||
$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"
|
||||
})
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
|
||||
@@ -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", "")]
|
||||
|
||||
Reference in New Issue
Block a user