Pattern: Malformed close brace
Issue: -
Close brace placement should follow a consistent style. It should be on a new line by itself and should not be followed by an empty line.
Rules = @{
PSPlaceCloseBrace = @{
Enable = $true
NoEmptyLineBefore = $false
IgnoreOneLineBlock = $true
NewLineAfter = $true
}
}
Enable or disable the rule during ScriptAnalyzer invocation.
Create violation if there is an empty line before a close brace.
Indicates if close braces in a one line block should be ignored or not. E.g. $x = if ($true) { "test" } else { "test test" } In the above example, if the property is set to true then the rule will not fire a violation.
Indicates if a new line should follow a close brace. If set to true a close brace should be followed by a new line.