Skip to content

Commit 27194d2

Browse files
committed
Add configuration instructions (again)
1 parent ae712f7 commit 27194d2

File tree

1 file changed

+42
-19
lines changed

1 file changed

+42
-19
lines changed

docs/Rules/UseCorrectCasing.md

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: Use exact casing of cmdlet/function/parameter name.
3-
ms.date: 06/28/2023
3+
ms.date: 03/19/2025
44
ms.topic: reference
55
title: UseCorrectCasing
66
---
@@ -10,35 +10,58 @@ title: UseCorrectCasing
1010

1111
## Description
1212

13-
This is a style/formatting rule. PowerShell is case insensitive wherever possible,
14-
so the casing of cmdlet names, parameters, keywords and operators does not matter.
15-
This rule nonetheless ensures consistent casing for clarity and readability.
16-
Using lowercase keywords helps distinguish them from commands.
17-
Using lowercase operators helps distinguish them from parameters.
13+
This is a style/formatting rule. PowerShell is case insensitive wherever possible, so the casing of
14+
cmdlet names, parameters, keywords and operators does not matter. This rule nonetheless ensures
15+
consistent casing for clarity and readability. Using lowercase keywords helps distinguish them from
16+
commands. Using lowercase operators helps distinguish them from parameters.
1817

1918
## How
2019

21-
Use exact casing for type names.
20+
- Use exact casing for type names.
21+
- Use exact casing of the cmdlet and its parameters.
22+
- Use lowercase for language keywords and operators.
2223

23-
Use exact casing of the cmdlet and its parameters, e.g.
24-
`Invoke-Command { 'foo' } -RunAsAdministrator`.
24+
## Configuration
2525

26-
Use lowercase for language keywords and operators.
26+
```powershell
27+
Rules = @{
28+
PS UseCorrectCasing = @{
29+
Enable = $true
30+
CheckCommands = $true
31+
CheckKeyword = $true
32+
CheckOperator = $true
33+
}
34+
}
35+
```
36+
37+
### Parameters
38+
39+
#### Enable: bool (Default value is `$false`)
40+
41+
Enable or disable the rule during ScriptAnalyzer invocation.
42+
43+
#### CheckCommands: bool (Default value is `$true`)
2744

28-
## Example
45+
If true, require the case of all operators to be lowercase.
2946

30-
### Wrong
47+
#### CheckKeyword: bool (Default value is `$true`)
48+
49+
If true, require the case of all keywords to be lowercase.
50+
51+
#### CheckOperator: bool (Default value is `$true`)
52+
53+
If true, require the case of all commands to match their actual casing.
54+
55+
## Examples
56+
57+
### Wrong way
3158

3259
```powershell
33-
ForEach ($file IN get-childitem -recurse) {
34-
$file.Extension -Eq '.txt'
35-
}
60+
invoke-command { 'foo' } -runasadministrator
3661
```
3762

38-
### Correct
63+
### Correct way
3964

4065
```powershell
41-
foreach ($file in Get-ChildItem -Recurse) {
42-
$file.Extension -eq '.txt'
43-
}
66+
Invoke-Command { 'foo' } -RunAsAdministrator
4467
```

0 commit comments

Comments
 (0)