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
Remove redundant whitespace between parameters with new option (disabled by default) in UseConsistentWhitespace (#1392)
* find extents of parameters elements
* first working prototype
* Productionize, add tests, docs and add to config files. TODO: message names
* tidy up
* add messages
* Apply suggestions from code review
Co-Authored-By: Robert Holt <rjmholt@gmail.com>
* revert suggestion around removal around expectedStartColumnNumberOfRightExtent variable, which broke build.
Variable is used 2 times and makes code more readable, therefore keeping it
* Tweak DiagnosticRecord creation and add more tests
* use named parameters for CorrectionExtent constructor
Co-authored-by: Robert Holt <rjmholt@gmail.com>
Copy file name to clipboardExpand all lines: RuleDocumentation/UseConsistentWhitespace.md
+6
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@
20
20
CheckOperator = $true
21
21
CheckPipe = $true
22
22
CheckSeparator = $true
23
+
CheckParameter = $false
23
24
}
24
25
}
25
26
```
@@ -53,3 +54,8 @@ Checks if a comma or a semicolon is followed by a space. E.g. `@(1, 2, 3)` or `@
53
54
#### CheckPipe: bool (Default value is `$true`)
54
55
55
56
Checks if a pipe is surrounded on both sides by a space. E.g. `foo | bar` instead of `foo|bar`.
57
+
58
+
#### CheckParameter: bool (Default value is `$false` at the moment due to the setting being new)
59
+
60
+
Checks if there is more than one space between parameters and values. E.g. `foo -bar $baz -bat` instead of `foo -bar $baz -bat`. This eliminates redundant whitespace that was probably added unintentionally.
61
+
The rule does not check for whitespace between parameter and value when the colon syntax `-ParameterName:$ParameterValue` is used as some users prefer either 0 or 1 whitespace in this case.
0 commit comments