Skip to content

Commit 184d969

Browse files
authored
Merge pull request #310 from sdwheeler/sdw-w406969-pssa-124
Update PSSA release 1.24
1 parent 5c1c34e commit 184d969

File tree

4 files changed

+76
-13
lines changed

4 files changed

+76
-13
lines changed

reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidUsingConvertToSecureStringWithPlainText.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: Avoid Using SecureString With Plain Text
3-
ms.date: 06/28/2023
3+
ms.date: 01/28/2025
44
ms.topic: reference
55
title: AvoidUsingConvertToSecureStringWithPlainText
66
---
Lines changed: 50 additions & 10 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,26 +10,66 @@ 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.
1717

1818
## How
1919

20-
Use exact casing of the cmdlet and its parameters, e.g.
21-
`Invoke-Command { 'foo' } -RunAsAdministrator`.
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-
## Example
24+
## Configuration
2425

25-
### Wrong
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`)
44+
45+
If true, require the case of all operators to be lowercase.
46+
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
2658

2759
```powershell
60+
ForEach ($file in Get-childitem -Recurse) {
61+
$file.Extension -eq '.txt'
62+
}
63+
2864
invoke-command { 'foo' } -runasadministrator
2965
```
3066

31-
### Correct
67+
### Correct way
3268

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

reference/docs-conceptual/PSScriptAnalyzer/whats-new-in-pssa.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: This article lists the updates to the PSScriptAnalyzer module.
3-
ms.date: 10/10/2024
3+
ms.date: 04/29/2025
44
title: What's new in PSScriptAnalyzer
55
---
66
# What's new in PSScriptAnalyzer
@@ -9,6 +9,29 @@ PSScriptAnalyzer is a static code checker for PowerShell modules and scripts. Th
99
the important changes in PSScriptAnalyzer. For a full list of changes, see the PSScriptAnalyzer
1010
[CHANGELOG][01].
1111

12+
## PSScriptAnalyzer 1.24.0 - 2025-03-18
13+
14+
Breaking changes
15+
16+
- Minimum required PowerShell version raised from 3 to 5.1
17+
18+
New features and updates
19+
20+
- Add new options (enabled by default) to formatting rule `UseCorrectCasing` to also correct
21+
operators, keywords and commands
22+
- `PSAlignAssignmentStatement`: Ignore hashtables with a single key-value pair
23+
- Use `RequiredResource` hashtable to specify PowerShell module versions
24+
- `PSAvoidAssignmentToAutomaticVariable`: Ignore when a Parameter has an Attribute that contains a
25+
Variable expression
26+
- Trim unnecessary trailing spaces from string resources in Strings.resx
27+
- Make Settings type detection more robust
28+
- Add foreach Assignment to `AvoidAssignmentToAutomaticVariable`
29+
- Do not print summary repeatedly for each logger
30+
- Set exit code of `Invoke-ScriptAnalyzer -EnableExit` to total number of diagnostics
31+
- `Invoke-ScriptAnalyzer`: Stream diagnostics instead of batching
32+
- `Invoke-ScriptAnalyzer`: Print summary only once per invocation
33+
- `Invoke-ScriptAnalyzer`: Include parse errors in reported error count
34+
1235
## PSScriptAnalyzer 1.23.0 - 2024-10-09
1336

1437
Small maintenance release to update the build pipeline and fix two issues:

reference/docs-conceptual/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ items:
3737
href: PlatyPS/overview.md
3838
- name: Create help using PlatyPS
3939
href: PlatyPS/create-help-using-platyps.md
40-
- name: PSScriptAnalyzer v1.23
40+
- name: PSScriptAnalyzer v1.24
4141
items:
4242
- name: Overview
4343
href: PSScriptAnalyzer/overview.md

0 commit comments

Comments
 (0)