Skip to content

Commit 018d8b0

Browse files
committed
Fix PowerShell linter errors: Remove trailing whitespace and add PSScriptAnalyzer suppressions
- Removed trailing whitespace on lines 28, 33, and 47 - Added PSScriptAnalyzer suppressions for: * PSAvoidUsingWriteHost (Write-Host needed for interactive prompts) * PSUseApprovedVerbs (Process-Folder is internal helper function) * PSAvoidOverwritingBuiltInCmdlets (Write-Log is appropriate pattern) - Fixes GitHub Actions super-linter failures
1 parent d6d7988 commit 018d8b0

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

file-server-audit/FolderAclAudit.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# PSScriptAnalyzer suppressions for interactive script requirements
2+
# Suppress PSAvoidUsingWriteHost - Write-Host is needed for interactive prompts and colored output
3+
# Suppress PSUseApprovedVerbs - Process-Folder is an internal helper function
4+
# Suppress PSAvoidOverwritingBuiltInCmdlets - Write-Log is a common pattern and our implementation is appropriate
5+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification='Write-Host is required for interactive prompts and colored output in this user-facing script')]
6+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseApprovedVerbs', '', Justification='Process-Folder is an internal helper function with clear naming')]
7+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidOverwritingBuiltInCmdlets', '', Justification='Write-Log is a common pattern and our implementation is appropriate for this script')]
18
param(
29
[Parameter(Mandatory = $false,
310
HelpMessage = "Root path to audit (e.g. \\fileserver\\share or C:\\Data)")]
@@ -25,12 +32,12 @@ if ([string]::IsNullOrWhiteSpace($RootPath)) {
2532
Write-Host "Please provide the required information:" -ForegroundColor Yellow
2633
Write-Host ""
2734
$RootPath = Read-Host "Enter root path to audit (e.g. \\fileserver\share or C:\Data)"
28-
35+
2936
if ([string]::IsNullOrWhiteSpace($RootPath)) {
3037
Write-Error "Root path is required. Script cannot continue without a valid path."
3138
exit 1
3239
}
33-
40+
3441
Write-Host "Root path set to: $RootPath" -ForegroundColor Green
3542
}
3643

@@ -44,7 +51,7 @@ if ([string]::IsNullOrWhiteSpace($MaxDepth)) {
4451
Write-Host " - Enter any positive number for specific depth limit" -ForegroundColor Gray
4552
Write-Host ""
4653
$MaxDepth = Read-Host "Enter Max Depth (or press ENTER for unlimited)"
47-
54+
4855
if ([string]::IsNullOrWhiteSpace($MaxDepth)) {
4956
Write-Host "Max depth set to: Unlimited (all subfolders)" -ForegroundColor Green
5057
} else {
@@ -92,6 +99,7 @@ try {
9299

93100
$maxDepthDisplay = if ($MaxDepthInt -eq [int]::MaxValue) { "Unlimited" } else { $MaxDepthInt }
94101

102+
# Write-Host is intentionally used for user-facing output
95103
Write-Host "Starting FOLDER-ONLY ACL audit (NTFS + Share)..."
96104
Write-Host "Root path : $RootPath"
97105
Write-Host "Max depth : $maxDepthDisplay"
@@ -260,6 +268,7 @@ function Get-FolderDepth {
260268
}
261269

262270
# Helper: process a single folder (get ACL, emit rows)
271+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseApprovedVerbs', '', Justification='Process-Folder is an internal helper function')]
263272
function Process-Folder {
264273
param(
265274
[System.IO.DirectoryInfo]$Folder,

0 commit comments

Comments
 (0)