PSScriptAnalyzer
PSScriptAnalyzer copied to clipboard
PSUseConsistentWhitespace should not flag for comments after a separator
Summary of the new feature
Whitespace after a separator but before a comment should not be a violation of PSUseConsistentWhitespace
Proposed technical implementation details (optional)
test.ps1 (note whitespace between foo,
and #
):
function test {
$Array = @(
'foo', # defined in RFC-666
'bar'
)
$Array
}
Settings.psd1:
@{
Rules = @{
PSUseConsistentWhitespace = @{
Enable = $true
CheckSeparator = $true
}
}
}
Current behaviour:
> Invoke-ScriptAnalyzer .\test.ps1 -Settings .\Settings.psd1
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSUseConsistentWhitespace Warning test.ps1 3 Use space after a comma.
Desired behaviour:
- no violation
What is the latest version of PSScriptAnalyzer at the point of writing
1.20.0