fix: clear the PowerShell lint debt and graduate lint to blocking - #6
Merged
Conversation
super-linter has never actually linted this repo: it lints changed files only,
and the only file changed since lint.yml landed was lint.yml. A full-codebase
pass reported 183 findings. All are now resolved.
Fixed at source (111):
PSAvoidUsingPositionalParameters (2) - a genuine output bug, not style.
`Write-Host "`n" + ("="*60)` passes THREE positional arguments, because
-Object takes the remaining arguments and joins them with a space. The
summary banner has been printing a literal '+' character. Parenthesised so
it is the string concatenation that was intended.
PSReviewUnusedParameter (4) - Get-TestDocumentation never used $TestName
(it derives everything from $TestFile) and Get-RemediationUrl never used
$TestType (its switch reads only $TestName). Each had exactly one caller,
passing the argument by name, so parameter and argument are removed
together. $testType is still assigned and still lands in the CSV row.
PSAvoidTrailingWhitespace (104) and PSUseBOMForUnicodeEncodedFile (1) -
whitespace stripped; a UTF-8 BOM added to the one file that actually holds
non-ASCII (the U+2713 check marks). The -Simple variant is pure ASCII and
is deliberately left without a BOM.
Excluded with justification (72):
PSAvoidUsingWriteHost - both scripts are interactive operator tools whose
colour-coded console output IS the interface; the machine-readable output
goes to CSV. Mirrors the identical exclusion in LukeEvansTech/veeam-config.
The rule's own rationale describes PowerShell 4 and earlier.
Verified with PSScriptAnalyzer in the super-linter v8.6.0 container: 0 findings
with the settings file, and 72 (Write-Host only) without it - so the exclusion
is doing exactly one job and not masking the rest. Full super-linter run over
the whole codebase exits 0.
lint.yml graduates to soft-launch: false.
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this repo was never actually linted
super-linter lints changed files only. The only file changed since
lint.ymllanded waslint.ymlitself, so the two PowerShell scripts have never been through it. A full-codebase pass (VALIDATE_ALL_CODEBASE=true, run locally againstsuper-linter:v8.6.0with this repo's exact CI env) reported 183 findings.One of them is a real bug
Write-Host's-Objectparameter takes the remaining arguments and joins them with a space, so this passes three positional arguments and prints a literal+:Parenthesised so it does the string concatenation that was intended.
PSAvoidUsingPositionalParametersearned its keep.Everything else
PSAvoidUsingWriteHostPSAvoidTrailingWhitespacePSReviewUnusedParameterPSAvoidUsingPositionalParametersPSUseBOMForUnicodeEncodedFileUnused parameters —
Get-TestDocumentationnever read$TestName(it derives everything from$TestFile);Get-RemediationUrlnever read$TestType(itsswitch -Regexreads only$TestName). Each has exactly one caller passing by name, so the parameter and the argument are removed together.$testTypeis still assigned at line 273 and still lands in the CSV row — only the dead pass-through went.BOM — added only to
Run-MaesterExchangeHealthCheck.ps1, which actually contains non-ASCII (the U+2713 check marks).-Simple.ps1is pure ASCII and is deliberately left alone.PSAvoidUsingWriteHost— excluded in a new.github/linters/.powershell-psscriptanalyzer.psd1. Both scripts are interactive operator tools; an admin runs them at a console and reads a colour-coded health-check report as it streams. The colour is the interface, nothing consumes stdout as data, and the machine-readable output goes totest_results.csvand the exported summary. Same exclusion, for the same reason, already exists inLukeEvansTech/veeam-config. The rule's stated rationale ("cannot be suppressed, captured, or redirected") describes PowerShell 4 and earlier — since 5.0Write-Hostwrites to the information stream.Verification
Run in the
super-linter:v8.6.0container:PSScriptAnalyzer: 0 findings72 PSAvoidUsingWriteHostand nothing elseThat second run is the one that matters: it proves the exclusion is doing exactly one job and not quietly masking the other 111, which are genuinely fixed.
Full super-linter over the whole codebase exits 0.
Graduation
soft-launch: false. Worth noting what soft-launch was actually costing here — per CLAUDE.md, super-linter posts a commit status per linter that escapescontinue-on-error, so--> Linted: POWERSHELLwould have started failing and silently blocking every Renovate PR the moment anything touched a.ps1.