Skip to content

Commit b9c5bd5

Browse files
committed
Add whitespace to equal signs in parameters
1 parent 09ec193 commit b9c5bd5

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

Best-Practices/Error-Handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
When trapping an error, try to use -ErrorAction Stop on cmdlets to generate terminating, trappable exceptions.
44

5-
# ERR-02 Use $ErrorActionPreference='Stop' or 'Continue' when calling non-cmdlets
5+
# ERR-02 Use $ErrorActionPreference = 'Stop' or 'Continue' when calling non-cmdlets
66

7-
When executing something other than a cmdlet, set $ErrorActionPreference='Stop' before executing, and re-set to Continue afterwards. If you're concerned about using -ErrorAction because it will bail on the entire pipeline, then you've probably over-constructed the pipeline. Consider using a more scripting-construct-style approach, because those approaches are inherently better for automated error handling.
7+
When executing something other than a cmdlet, set $ErrorActionPreference = 'Stop' before executing, and re-set to Continue afterwards. If you're concerned about using -ErrorAction because it will bail on the entire pipeline, then you've probably over-constructed the pipeline. Consider using a more scripting-construct-style approach, because those approaches are inherently better for automated error handling.
88

99
Ideally, whatever command or code you think might bomb should be dealing with one thing: querying one computer, deleting one file, updating one user. That way, if an error occurs, you can handle it and then get on with the next thing.
1010

Best-Practices/TODO.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ It doesn't do anything, and it confuses future readers.
149149
When prompted for a mandatory parameter, a user can request HelpText, but can't look at the documentation. It's frequently useful to duplicate at least the first sentence or two of the parameter help.
150150

151151
```
152-
[Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$true,
153-
ValueFromPipelineByPropertyName=$true, HelpText='The name of the file to read')]
152+
[Parameter(Position = 1, Mandatory = $true, ValueFromPipeline = $true,
153+
ValueFromPipelineByPropertyName = $true, HelpText = 'The name of the file to read')]
154154
[Alias('PSPath','FullName','Path')]
155155
[String]$File
156156
```
@@ -208,7 +208,7 @@ Discuss: when is this critical (-whatif) and optional (-confirm_
208208
Discuss: when should you call PSCmdlet.ShouldProcess vs PSCmdlet.ShouldContinue (-Force)
209209

210210
```
211-
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact="Medium")]
211+
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Medium")]
212212
param([Switch]$Force)
213213
214214
$RejectAll = $false;

Style-Guide/Code-Layout-and-Formatting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function Write-Host {
3939
#>
4040
[CmdletBinding()]
4141
param(
42-
[Parameter(Position=0, ValueFromPipeline=$true, ValueFromRemainingArguments=$true)]
42+
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromRemainingArguments = $true)]
4343
[PSObject]
4444
$Object,
4545

Style-Guide/Documentation-and-Comments.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ Examples can be found in the ISE snippets:
8484
```powershell
8585
Param(
8686
# Param1 help description
87-
[Parameter(Mandatory=$true,
88-
ValueFromPipelineByPropertyName=$true,
89-
Position=0)]
87+
[Parameter(Mandatory = $true,
88+
ValueFromPipelineByPropertyName = $true,
89+
Position = 0)]
9090
$Param1,
9191
9292
    # Param2 help description
@@ -116,7 +116,7 @@ function Test-Help {
116116
param(
117117
# This parameter doesn't do anything.
118118
# Aliases: MP
119-
[Parameter(Mandatory=$true)]
119+
[Parameter(Mandatory = $true)]
120120
[Alias("MP")]
121121
[String]$MandatoryParameter
122122
)

Style-Guide/Function-Structure.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ function Get-USCitizenCapability {
2828
[CmdletBinding()]
2929
[OutputType([psobject])]
3030
param (
31-
[Parameter(Mandatory=$true,
32-
ValueFromPipelineByPropertyName=$true,
33-
Position=0)]
31+
[Parameter(Mandatory = $true,
32+
ValueFromPipelineByPropertyName = $true,
33+
Position = 0)]
3434
[int16]
3535
$Age
3636
)
@@ -55,9 +55,9 @@ function Get-USCitizenCapability {
5555
[CmdletBinding()]
5656
[OutputType([psobject])]
5757
param (
58-
[Parameter(Mandatory=$true,
59-
ValueFromPipelineByPropertyName=$true,
60-
Position=0)]
58+
[Parameter(Mandatory = $true,
59+
ValueFromPipelineByPropertyName = $true,
60+
Position = 0)]
6161
[int16]
6262
$Age
6363
)
@@ -87,23 +87,23 @@ function Get-USCitizenCapability {
8787
If the function returns different object types depending on the parameter set provide one per parameter set.
8888

8989
```PowerShell
90-
[OutputType([<TypeLiteral>], ParameterSetName="<Name>")]
91-
[OutputType("<TypeNameString>", ParameterSetName="<Name>")]
90+
[OutputType([<TypeLiteral>], ParameterSetName = "<Name>")]
91+
[OutputType("<TypeNameString>", ParameterSetName = "<Name>")]
9292
```
9393

9494
#### When a ParameterSetName is used in any of the parameters, always provide a DefaultParameterSetName in the CmdletBinding attribute.
9595

9696
```PowerShell
9797
function Get-User {
98-
[CmdletBinding(DefaultParameterSetName="ID")]
99-
[OutputType("System.Int32", ParameterSetName="ID")]
100-
[OutputType([String], ParameterSetName="Name")]
98+
[CmdletBinding(DefaultParameterSetName = "ID")]
99+
[OutputType("System.Int32", ParameterSetName = "ID")]
100+
[OutputType([String], ParameterSetName = "Name")]
101101
param (
102-
[parameter(Mandatory=$true, ParameterSetName="ID")]
102+
[parameter(Mandatory = $true, ParameterSetName = "ID")]
103103
[Int[]]
104104
$UserID,
105105
106-
[parameter(Mandatory=$true, ParameterSetName="Name")]
106+
[parameter(Mandatory = $true, ParameterSetName = "Name")]
107107
[String[]]
108108
$UserName
109109
)
@@ -119,7 +119,7 @@ function Get-User {
119119

120120
```PowerShell
121121
param (
122-
[Parameter(Mandatory=$true)]
122+
[Parameter(Mandatory = $true)]
123123
[AllowNull()]
124124
[String]
125125
$ComputerName
@@ -132,7 +132,7 @@ function Get-User {
132132

133133
```PowerShell
134134
param (
135-
[Parameter(Mandatory=$true)]
135+
[Parameter(Mandatory = $true)]
136136
[AllowEmptyString()]
137137
[String]
138138
$ComputerName
@@ -145,7 +145,7 @@ function Get-User {
145145

146146
```PowerShell
147147
param (
148-
[Parameter(Mandatory=$true)]
148+
[Parameter(Mandatory = $true)]
149149
[AllowEmptyCollection()]
150150
[String[]]
151151
$ComputerName
@@ -161,7 +161,7 @@ function Get-User {
161161

162162
```PowerShell
163163
param (
164-
[Parameter(Mandatory=$true)]
164+
[Parameter(Mandatory = $true)]
165165
[ValidateCount(1,5)]
166166
[String[]]
167167
$ComputerName
@@ -177,7 +177,7 @@ function Get-User {
177177

178178
```PowerShell
179179
param (
180-
[Parameter(Mandatory=$true)]
180+
[Parameter(Mandatory = $true)]
181181
[ValidateLength(1,10)]
182182
[String[]]
183183
$ComputerName
@@ -192,7 +192,7 @@ function Get-User {
192192
pattern.
193193
```PowerShell
194194
param (
195-
[Parameter(Mandatory=$true)]
195+
[Parameter(Mandatory = $true)]
196196
[ValidatePattern("[0-9][0-9][0-9][0-9]")]
197197
[String[]]
198198
$ComputerName
@@ -206,7 +206,7 @@ function Get-User {
206206
if any value is outside that range.
207207
```PowerShell
208208
param (
209-
[Parameter(Mandatory=$true)]
209+
[Parameter(Mandatory = $true)]
210210
[ValidateRange(0,10)]
211211
[Int]
212212
$Attempts
@@ -243,7 +243,7 @@ function Get-User {
243243

244244
```PowerShell
245245
param (
246-
[Parameter(Mandatory=$true)]
246+
[Parameter(Mandatory = $true)]
247247
[ValidateSet("Low", "Average", "High")]
248248
[String[]]
249249
$Detail
@@ -264,7 +264,7 @@ function Get-User {
264264
match the specified type.)
265265
```PowerShell
266266
param (
267-
[Parameter(Mandatory=$true)]
267+
[Parameter(Mandatory = $true)]
268268
[ValidateNotNull()]
269269
$ID
270270
)
@@ -279,7 +279,7 @@ function Get-User {
279279
array.
280280
```PowerShell
281281
param (
282-
[Parameter(Mandatory=$true)]
282+
[Parameter(Mandatory = $true)]
283283
[ValidateNotNullOrEmpty()]
284284
[String[]]
285285
$UserName

0 commit comments

Comments
 (0)