Closed
Description
From @ebmarquez in PowerShell/vscode-powershell#1958.
Repro:
$script = @'
function verb-noun {
<#
.SYNOPSIS
example
.INPUTS
String
System.Management.Automation.PSCredential
.OUTPUTS
System.Management.Automation.PSCustomObject
.NOTES
#>
[CmdLetBinding()]
[OutputType([PSCustomObject])]
Param(
# Computer
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
$Computer,
# Credential
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$Credential
)
$cmd = Get-ShowCommands | Where-Object { $_.Name -eq 'running-config' }
$result = Invoke-NetDeviceShowCommand -Computer $Computer -Credential $Credential -Command $cmd.CommandLine
Add-Member -InputObject $result -MemberType NoteProperty -Name "Name" -Value $cmd.Name
return $result
'@
$PSUseConsistentIndentation = @{
Enable = 'true'
IndentationSize = 4;
PipelineIndentation = 'IncreaseIndentationForFirstPipeline';
Kind = 'space'
}
$rules = @{
PSUseConsistentIndentation = $PSUseConsistentIndentation;
}
Invoke-Formatter -ScriptDefinition $script -Settings @{
IncludeRules = @('PSUserConsistentIndentation')
Rules = $rules
}
Actual Output:
function verb-noun {
<#
.SYNOPSIS
example
.INPUTS
String
System.Management.Automation.PSCredential
.OUTPUTS
System.Management.Automation.PSCustomObject
.NOTES
#>
[CmdLetBinding()]
[OutputType([PSCustomObject])]
Param(
# Computer
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
$Computer,
# Credential
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$Credential
)
$cmd = Get-ShowCommands | Where-Object { $_.Name -eq 'running-config' }
$result = Invoke-NetDeviceShowCommand -Computer $Computer -Credential $Credential -Command $cmd.CommandLine
Add-Member -InputObject $result -MemberType NoteProperty -Name "Name" -Value $cmd.Name
return $result
}
Notice $cmd = ...
is indented differently to $result = ...
onward.
I would expect $result = ...
etc to indent as $cmd = ...
has.
I'll let @ebmarquez follow up.
Metadata
Metadata
Assignees
Labels
No labels