Skip to content

Commit ea73edc

Browse files
authored
Add configuration instructions for UseCorrectCasing (again) (#2090)
* Add configuration instructions (again) * Add example for keyword * Fix typo
1 parent 4b4a136 commit ea73edc

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

Diff for: docs/Rules/UseCorrectCasing.md

+28-17
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,10 +10,16 @@ title: UseCorrectCasing
1010

1111
## Description
1212

13-
This is a style formatting rule. PowerShell is case insensitive where applicable. The casing of
14-
cmdlet names or parameters does not matter but this rule ensures that the casing matches for
15-
consistency and also because most cmdlets/parameters start with an upper case and using that
16-
improves readability to the human eye.
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.
17+
18+
## How
19+
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.
1723

1824
## Configuration
1925

@@ -28,37 +34,42 @@ Rules = @{
2834
}
2935
```
3036

31-
### Enable: bool (Default value is `$false`)
37+
### Parameters
38+
39+
#### Enable: bool (Default value is `$false`)
3240

3341
Enable or disable the rule during ScriptAnalyzer invocation.
3442

35-
### CheckCommands: bool (Default value is `$true`)
43+
#### CheckCommands: bool (Default value is `$true`)
3644

3745
If true, require the case of all operators to be lowercase.
3846

39-
### CheckKeyword: bool (Default value is `$true`)
47+
#### CheckKeyword: bool (Default value is `$true`)
4048

4149
If true, require the case of all keywords to be lowercase.
4250

43-
### CheckOperator: bool (Default value is `$true`)
51+
#### CheckOperator: bool (Default value is `$true`)
4452

4553
If true, require the case of all commands to match their actual casing.
4654

47-
## How
48-
49-
Use exact casing of the cmdlet and its parameters, e.g.
50-
`Invoke-Command { 'foo' } -RunAsAdministrator`.
55+
## Examples
5156

52-
## Example
53-
54-
### Wrong
57+
### Wrong way
5558

5659
```powershell
60+
ForEach ($file in Get-childitem -Recurse) {
61+
$file.Extension -eq '.txt'
62+
}
63+
5764
invoke-command { 'foo' } -runasadministrator
5865
```
5966

60-
### Correct
67+
### Correct way
6168

6269
```powershell
70+
foreach ($file in Get-ChildItem -Recurse) {
71+
$file.Extension -eq '.txt'
72+
}
73+
6374
Invoke-Command { 'foo' } -RunAsAdministrator
6475
```

0 commit comments

Comments
 (0)