-
Notifications
You must be signed in to change notification settings - Fork 403
Closed
Description
Steps to reproduce
- Define a script that contains custom object syntax
# Build output object and add to array
$ServerArray += [PSCustomObject]@{
ComputerName = $VMName
vCenterName = $vCenter.name.Split('@')[1]
}- Run PSScriptAnalyzer with the built-in 'CodeFormattingOTBS' settings preset.
Invoke-ScriptAnalyzer -path ./test.ps1 -Settings 'CodeFormattingOTBS'-
Note that
PSAlignAssignmentStatementrule throws a Warning. -
Correct error by aligning assignment statements.
# Build output object and add to array
$ServerArray += [PSCustomObject]@{
ComputerName = $VMName
vCenterName = $vCenter.name.Split('@')[1]
}- Run PSScriptAnalyzer with the built-in 'CodeFormattingOTBS' settings preset again.
Invoke-ScriptAnalyzer -path ./test.ps1 -Settings 'CodeFormattingOTBS'Expected behavior
No errors.
Actual behavior
PSUseConsistentWhitespace throws an error due to the multiple spaces before the assignment operator =.
This also happens when using the -Fix parameter of Invoke-ScriptAnalyzer. It will simply switch back and forth between the two errors each time you execute the command with -Fix.
Environment data
MacOS Catalina 10.15.5

