Open iRon7 opened 1 year ago
Adding another parameter set is not worth the added complexity in my honest opinion. It's a nice but not necessary feature, therefore I'd lean towards closing, what do you think @JamesWTruher ?
What about simply accepting an object (instead of a string) and stringify ($ScriptDefinition = [String]$ScriptDefinition
that for the current -ScriptDefinition
implementation?
.\Invoke-ScriptAnalyzer.ps1 -ScriptDefinition { Write-Host 'Test:' "$Test" }
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSAvoidTrailingWhitespace Information 1 Line has trailing whitespace
PSAvoidUsingWriteHost Warning 1 Script definition uses Write-Host. Avoid using Write-Host
because it might not work in all hosts, does not work when
there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
Summary of the new feature
[ScriptBlock]
s might contain both single and double quotes therefore it would makes sense to accept aScriptBlock
for the-ScriptDefinition
parameter so that it isn't necessarily to replace either the single quotes or double quotes in e.g. (Pester) test scenario's.Proposed technical implementation details (optional)
(Workaround)
What is the latest version of PSScriptAnalyzer at the point of writing
1.21.0