You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[PSAlignAssignmentRuleStatement](https://github.com/PowerShell/PSScriptAnalyzer/blob/cca9a2d7ee35be7322f8c5a09b6c500a0a8bd101/RuleDocumentation/AlignAssignmentStatement.md) rule to align assignment statements in property value pairs (#753).
10
+
11
+
### Fixed
12
+
-`PSAvoidGlobalVars` rule to ignore `$global:lastexitcode` (#752).
13
+
-`PSUseConsistentIndentation` to account for backtick on preceding line (#749).
14
+
-`PSPlaceCloseBrace` to ignore one-line blocks when `NewLineAfter` switch is on (#748).
- Built-in settings presets to specify settings from command line (#717). Currently, PSSA ships with `PSGallery`, `CodeFormatting`, `DSC`, and other settings presets. All of them can be found in the `Settings/` directory in the module. To use them just pass them as an argument to the `Settings` parameter. For example, if you want to run rules that *powershellgallery* runs, then use the following command.
- Built-in settings presets to specify settings from command line (#717). Currently, PSSA ships with `PSGallery`, `CodeFormatting`, `DSC`, and other settings presets. All of them can be found in the `Settings/` directory in the module. To use them just pass them as an argument to the `Settings` parameter. For example, if you want to run rules that *powershellgallery* runs, then use the following command.
Consecutive assignment statements are more readable if they are aligned. By aligned, we imply that the `equal` sign for all the assignment statements should be in the same column.
8
+
9
+
The rule looks for key (property) value pairs in a hashtable (DSC configuration) to check if they are aligned or not. Consider the following example in which the key value pairs are not aligned.
10
+
11
+
```powershell
12
+
$hashtable = @{
13
+
property1 = "value"
14
+
anotherProperty = "another value"
15
+
}
16
+
```
17
+
18
+
Alignment in this case would look like the following.
19
+
20
+
```powershell
21
+
$hashtable = @{
22
+
property1 = "value"
23
+
anotherProperty = "another value"
24
+
}
25
+
```
26
+
27
+
The rule will ignore hashtables in which the assignment statements are on the same line. For example, the rule will ignore `$h = {a = 1; b = 2}`.
28
+
29
+
## Configuration
30
+
31
+
```powershell
32
+
Rules = @{
33
+
PSAlignAssignmentStatement = @{
34
+
Enable = $true
35
+
CheckHashtable = $true
36
+
}
37
+
}
38
+
```
39
+
40
+
### Parameters
41
+
42
+
#### Enable: bool (Default value is `$false`)
43
+
44
+
Enable or disable the rule during ScriptAnalyzer invocation.
45
+
46
+
#### CheckHashtable: bool (Default value is `$false`)
47
+
48
+
Enforce alignment of assignment statements in a hashtable and in a DSC Configuration. There is only one switch for hasthable and DSC configuration because the property value pairs in a DSC configuration are parsed as key value pairs of a hashtable.
0 commit comments