Skip to content

Commit 76e1bbf

Browse files
authored
Change double quotes to single in docs where possible (#1911)
1 parent a289e7f commit 76e1bbf

23 files changed

+59
-59
lines changed

docs/Rules/AlignAssignmentStatement.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ are aligned or not. Consider the following example in which the key value pairs
1919

2020
```powershell
2121
$hashtable = @{
22-
property1 = "value"
23-
anotherProperty = "another value"
22+
property1 = 'value'
23+
anotherProperty = 'another value'
2424
}
2525
```
2626

2727
Alignment in this case would look like the following.
2828

2929
```powershell
3030
$hashtable = @{
31-
property1 = "value"
32-
anotherProperty = "another value"
31+
property1 = 'value'
32+
anotherProperty = 'another value'
3333
}
3434
```
3535

docs/Rules/AvoidGlobalAliases.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Use other scope modifiers for new aliases.
2828
### Wrong
2929

3030
```powershell
31-
New-Alias -Name Name -Value Value -Scope "Global"
31+
New-Alias -Name Name -Value Value -Scope Global
3232
```
3333

3434
### Correct

docs/Rules/AvoidInvokingEmptyMembers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ Provide the requested members for a given type or class.
2323
### Wrong
2424

2525
```powershell
26-
$MyString = "abc"
26+
$MyString = 'abc'
2727
$MyString.('len'+'gth')
2828
```
2929

3030
### Correct
3131

3232
```powershell
33-
$MyString = "abc"
33+
$MyString = 'abc'
3434
$MyString.('length')
3535
```

docs/Rules/AvoidOverwritingBuiltInCmdlets.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ following your settings file.
2626
@{
2727
'Rules' = @{
2828
'PSAvoidOverwritingBuiltInCmdlets' = @{
29-
'PowerShellVersion' = @("core-6.1.0-windows")
29+
'PowerShellVersion' = @('core-6.1.0-windows')
3030
}
3131
}
3232
}
@@ -38,8 +38,8 @@ following your settings file.
3838

3939
The parameter `PowerShellVersion` is a list of allowlists that ship with PSScriptAnalyzer.
4040

41-
**Note**: The default value for `PowerShellVersion` is `"core-6.1.0-windows"` if PowerShell 6 or
42-
later is installed, and `"desktop-5.1.14393.206-windows"` if it is not.
41+
**Note**: The default value for `PowerShellVersion` is `core-6.1.0-windows` if PowerShell 6 or
42+
later is installed, and `desktop-5.1.14393.206-windows` if it is not.
4343

4444
Usually, patched versions of PowerShell have the same cmdlet data, therefore only settings of major
4545
and minor versions of PowerShell are supplied. One can also create a custom settings file as well

docs/Rules/AvoidShouldContinueWithoutForce.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Function Test-ShouldContinue
3333
$MyString = 'blah'
3434
)
3535
36-
if ($PsCmdlet.ShouldContinue("ShouldContinue Query", "ShouldContinue Caption"))
36+
if ($PsCmdlet.ShouldContinue('ShouldContinue Query', 'ShouldContinue Caption'))
3737
{
3838
...
3939
}
@@ -52,7 +52,7 @@ Function Test-ShouldContinue
5252
[Switch]$Force
5353
)
5454
55-
if ($Force -or $PsCmdlet.ShouldContinue("ShouldContinue Query", "ShouldContinue Caption"))
55+
if ($Force -or $PsCmdlet.ShouldContinue('ShouldContinue Query', 'ShouldContinue Caption'))
5656
{
5757
...
5858
}

docs/Rules/AvoidUsingComputerNameHardcoded.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Remove hard coded computer names.
2525
```powershell
2626
Function Invoke-MyRemoteCommand ()
2727
{
28-
Invoke-Command -Port 343 -ComputerName "hardcoderemotehostname"
28+
Invoke-Command -Port 343 -ComputerName hardcoderemotehostname
2929
}
3030
```
3131

@@ -45,7 +45,7 @@ Function Invoke-MyCommand ($ComputerName)
4545
```powershell
4646
Function Invoke-MyLocalCommand ()
4747
{
48-
Invoke-Command -Port 343 -ComputerName "hardcodelocalhostname"
48+
Invoke-Command -Port 343 -ComputerName 'hardcodelocalhostname'
4949
}
5050
```
5151

docs/Rules/AvoidUsingConvertToSecureStringWithPlainText.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ module from the PowerShell Gallery.
3030
### Wrong
3131

3232
```powershell
33-
$UserInput = Read-Host "Please enter your secure code"
33+
$UserInput = Read-Host 'Please enter your secure code'
3434
$EncryptedInput = ConvertTo-SecureString -String $UserInput -AsPlainText -Force
3535
```
3636

3737
### Correct
3838

3939
```powershell
40-
$SecureUserInput = Read-Host "Please enter your secure code" -AsSecureString
40+
$SecureUserInput = Read-Host 'Please enter your secure code' -AsSecureString
4141
$EncryptedInput = ConvertFrom-SecureString -String $SecureUserInput
4242
$SecureString = ConvertTo-SecureString -String $EncryptedInput
4343
```

docs/Rules/AvoidUsingEmptyCatchBlock.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ try
4141
}
4242
catch [DivideByZeroException]
4343
{
44-
Write-Error "DivideByZeroException"
44+
Write-Error 'DivideByZeroException'
4545
}
4646
4747
try
@@ -50,6 +50,6 @@ try
5050
}
5151
catch [DivideByZeroException]
5252
{
53-
throw "DivideByZeroException"
53+
throw 'DivideByZeroException'
5454
}
5555
```

docs/Rules/AvoidUsingInvokeExpression.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Remove the use of `Invoke-Expression`.
2626
### Wrong
2727

2828
```powershell
29-
Invoke-Expression "Get-Process"
29+
Invoke-Expression 'Get-Process'
3030
```
3131

3232
### Correct

docs/Rules/AvoidUsingWMICmdlet.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ Change to the equivalent CIM based cmdlet.
4848

4949
```powershell
5050
Get-WmiObject -Query 'Select * from Win32_Process where name LIKE "myprocess%"' | Remove-WmiObject
51-
Invoke-WmiMethod -Class Win32_Process -Name "Create" -ArgumentList @{ CommandLine = "notepad.exe" }
51+
Invoke-WmiMethod -Class Win32_Process -Name 'Create' -ArgumentList @{ CommandLine = 'notepad.exe' }
5252
```
5353

5454
### Correct
5555

5656
```powershell
5757
Get-CimInstance -Query 'Select * from Win32_Process where name LIKE "myprocess%"' | Remove-CIMInstance
58-
Invoke-CimMethod -ClassName Win32_Process -MethodName "Create" -Arguments @{ CommandLine = "notepad.exe" }
58+
Invoke-CimMethod -ClassName Win32_Process -MethodName 'Create' -Arguments @{ CommandLine = 'notepad.exe' }
5959
```

docs/Rules/AvoidUsingWriteHost.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ title: AvoidUsingWriteHost
1212
## Description
1313

1414
The use of `Write-Host` is greatly discouraged unless in the use of commands with the `Show` verb.
15-
The `Show` verb explicitly means "show on the screen, with no other possibilities".
15+
The `Show` verb explicitly means 'show on the screen, with no other possibilities'.
1616

1717
Commands with the `Show` verb do not have this check applied.
1818

@@ -29,7 +29,7 @@ logging or returning one or more objects.
2929
function Get-MeaningOfLife
3030
{
3131
...
32-
Write-Host "Computing the answer to the ultimate question of life, the universe and everything"
32+
Write-Host 'Computing the answer to the ultimate question of life, the universe and everything'
3333
...
3434
Write-Host 42
3535
}
@@ -42,13 +42,13 @@ function Get-MeaningOfLife
4242
{
4343
[CmdletBinding()]Param() # to make it possible to set the VerbosePreference when calling the function
4444
...
45-
Write-Verbose "Computing the answer to the ultimate question of life, the universe and everything"
45+
Write-Verbose 'Computing the answer to the ultimate question of life, the universe and everything'
4646
...
4747
Write-Output 42
4848
}
4949
5050
function Show-Something
5151
{
52-
Write-Host "show something on screen";
52+
Write-Host 'show something on screen'
5353
}
5454
```

docs/Rules/DSCUseVerboseMessageInDSCResource.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Function Test-Function
3838
{
3939
[CmdletBinding()]
4040
Param()
41-
Write-Verbose "Verbose output"
41+
Write-Verbose 'Verbose output'
4242
...
4343
}
4444
```

docs/Rules/PlaceCloseBrace.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Create violation if there is an empty line before a close brace.
4242
#### IgnoreOneLineBlock: bool (Default value is `$true`)
4343

4444
Indicates if closed brace pairs in a one line block should be ignored or not. For example,
45-
`$x = if ($true) { "blah" } else { "blah blah" }`, if the property is set to true then the rule
45+
`$x = if ($true) { 'blah' } else { 'blah blah' }`, if the property is set to true then the rule
4646
doesn't fire a violation.
4747

4848
#### NewLineAfter: bool (Default value is `$true`)

docs/Rules/PlaceOpenBrace.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ Enforce a new line character after an open brace. The default value is true.
4646
#### IgnoreOneLineBlock: bool (Default value is `$true`)
4747

4848
Indicates if open braces in a one line block should be ignored or not. For example,
49-
` $x = if ($true) { "blah" } else { "blah blah" }`, if the property is set to true then the rule
49+
` $x = if ($true) { 'blah' } else { 'blah blah' }`, if the property is set to true then the rule
5050
doesn't fire a violation.

docs/Rules/ProvideCommentHelp.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Rules = @{
3030
ExportedOnly = $false
3131
BlockComment = $true
3232
VSCodeSnippetCorrection = $false
33-
Placement = "before"
33+
Placement = 'before'
3434
}
3535
}
3636
```

docs/Rules/ShouldProcess.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function Set-File
4242
[Parameter(Mandatory=$true)]
4343
$Path
4444
)
45-
"String" | Out-File -FilePath $Path
45+
'String' | Out-File -FilePath $Path
4646
}
4747
```
4848

@@ -62,7 +62,7 @@ function Set-File
6262
[string]$Content
6363
)
6464
65-
if ($PSCmdlet.ShouldProcess($Path, ("Setting content to '{0}'" -f $Content)))
65+
if ($PSCmdlet.ShouldProcess($Path, ('Setting content to '{0}'' -f $Content)))
6666
{
6767
$Content | Out-File -FilePath $Path
6868
}

docs/Rules/UseCompatibleCmdlets.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ the following your settings file:
2323
@{
2424
'Rules' = @{
2525
'PSUseCompatibleCmdlets' = @{
26-
'compatibility' = @("core-6.1.0-windows")
26+
'compatibility' = @('core-6.1.0-windows')
2727
}
2828
}
2929
}

docs/Rules/UseCompatibleCommands.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The default profile directory is under the PSScriptAnalzyer module at
8282
`$PSScriptRoot/compatibility_profiles` (where `$PSScriptRoot` here refers to the directory
8383
containing `PSScriptAnalyzer.psd1`).
8484

85-
The compatibility analysis compares a command used to both a target profile and a "union" profile
85+
The compatibility analysis compares a command used to both a target profile and a 'union' profile
8686
(containing all commands available in *any* profile in the profile dir). If a command is not present
8787
in the union profile, it is assumed to be locally created and ignored. Otherwise, if a command is
8888
present in the union profile but not present in a target, it is deemed to be incompatible with that
@@ -126,17 +126,17 @@ Command compatibility diagnostics can be suppressed with an attribute on the `pa
126126
scriptblock as with other rules.
127127

128128
```powershell
129-
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleCommands", "")]
129+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', '')]
130130
```
131131

132132
The rule can also be suppressed only for particular commands:
133133

134134
```powershell
135-
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleCommands", "Start-Service")]
135+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Start-Service')]
136136
```
137137

138138
And also suppressed only for parameters:
139139

140140
```powershell
141-
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleCommands", "Import-Module/FullyQualifiedName")]
141+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Import-Module/FullyQualifiedName')]
142142
```

docs/Rules/UseCompatibleSyntax.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ PowerShell versions because they aren't able to parse the incompatible syntaxes.
2222
PSUseCompatibleSyntax = @{
2323
Enable = $true
2424
TargetVersions = @(
25-
"6.0",
26-
"5.1",
27-
"4.0"
25+
'6.0',
26+
'5.1',
27+
'4.0'
2828
)
2929
}
3030
}

docs/Rules/UseCompatibleTypes.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ The default profile directory is under the PSScriptAnalzyer module at
8383
`$PSScriptRoot/PSCompatibilityCollector/profiles` (where `$PSScriptRoot` here refers to the
8484
directory containing `PSScriptAnalyzer.psd1`).
8585

86-
The compatibility analysis compares a type used to both a target profile and a "union" profile
87-
(containing all types available in *any* profile in the profile dir). If a type is not present in
86+
The compatibility analysis compares a type used to both a target profile and a 'union' profile
87+
(containing all types available in _any_ profile in the profile dir). If a type is not present in
8888
the union profile, it is assumed to be locally created and ignored. Otherwise, if a type is present
8989
in the union profile but not present in a target, it is deemed to be incompatible with that target.
9090

@@ -127,11 +127,11 @@ PS> $settings = @{
127127
Rules = @{
128128
PSUseCompatibleTypes = @{
129129
Enable = $true
130-
TargetProfiles = @("win-48_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework")
130+
TargetProfiles = @('win-48_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework')
131131
}
132132
}
133133
}
134-
PS> Invoke-ScriptAnalyzer -Settings $settings -ScriptDefinition '[System.Management.Automation.SemanticVersion]"1.18.0-rc1"'
134+
PS> Invoke-ScriptAnalyzer -Settings $settings -ScriptDefinition '[System.Management.Automation.SemanticVersion]'1.18.0-rc1''
135135
136136
RuleName Severity ScriptName Line Message
137137
-------- -------- ---------- ---- -------
@@ -146,17 +146,17 @@ Command compatibility diagnostics can be suppressed with an attribute on the `pa
146146
scriptblock as with other rules.
147147

148148
```powershell
149-
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleTypes", "")]
149+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleTypes', '')]
150150
```
151151

152152
The rule can also be suppressed only for particular types:
153153

154154
```powershell
155-
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleTypes", "System.Management.Automation.Security.SystemPolicy")]
155+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleTypes', 'System.Management.Automation.Security.SystemPolicy')]
156156
```
157157

158158
And also suppressed only for type members:
159159

160160
```powershell
161-
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleCommands", "System.Management.Automation.LanguagePrimitives/ConvertTypeNameToPSTypeName")]
161+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'System.Management.Automation.LanguagePrimitives/ConvertTypeNameToPSTypeName')]
162162
```

docs/Rules/UseDeclaredVarsMoreThanAssignments.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Variables that are assigned but not used are not needed.
1515

1616
> [!NOTE]
1717
> For this rule, the variable must be used within the same scriptblock that it was declared or it
18-
> won't be considered to be "used".
18+
> won't be considered to be 'used'.
1919
2020
## How
2121

@@ -28,8 +28,8 @@ Remove the variables that are declared but not used.
2828
```powershell
2929
function Test
3030
{
31-
$declaredVar = "Declared just for fun"
32-
$declaredVar2 = "Not used"
31+
$declaredVar = 'Declared just for fun'
32+
$declaredVar2 = 'Not used'
3333
Write-Output $declaredVar
3434
}
3535
```
@@ -39,7 +39,7 @@ function Test
3939
```powershell
4040
function Test
4141
{
42-
$declaredVar = "Declared just for fun"
42+
$declaredVar = 'Declared just for fun'
4343
Write-Output $declaredVar
4444
}
4545
```

docs/Rules/UseOutputTypeCorrectly.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ function Get-Foo
4545
Param(
4646
)
4747
48-
return "four"
48+
return 'four'
4949
}
5050
```

0 commit comments

Comments
 (0)