Skip to content

Commit 03b655c

Browse files
authored
Update format and grammar of AvoidUsingAllowUnencryptedAuthentication (#1974)
* Update format and grammar of AvoidUsingAllowUnencryptedAuthentication * Syncing docs changes to all rules * Update rules to match docs and improve wording
1 parent b4365ad commit 03b655c

7 files changed

+39
-22
lines changed

docs/Rules/AvoidExclaimOperator.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Avoid exclaim operator
33
ms.custom: PSSA v1.22.0
4-
ms.date: 06/14/2023
4+
ms.date: 02/13/2024
55
ms.topic: reference
66
title: AvoidExclaimOperator
77
---
@@ -10,20 +10,23 @@ title: AvoidExclaimOperator
1010

1111
## Description
1212

13-
The negation operator `!` should not be used for readability purposes. Use `-not` instead.
13+
Avoid using the negation operator (`!`). Use `-not` for improved readability.
1414

15-
**Note**: This rule is not enabled by default. The user needs to enable it through settings.
15+
> [!NOTE]
16+
> This rule is not enabled by default. The user needs to enable it through settings.
1617
1718
## How to Fix
1819

1920
## Example
21+
2022
### Wrong:
21-
```PowerShell
23+
24+
```powershell
2225
$MyVar = !$true
2326
```
2427

2528
### Correct:
26-
```PowerShell
29+
```powershell
2730
$MyVar = -not $true
2831
```
2932

docs/Rules/AvoidUsingAllowUnencryptedAuthentication.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Avoid sending credentials and secrets over unencrypted connections
33
ms.custom: PSSA v1.22.0
4-
ms.date: 11/06/2022
4+
ms.date: 02/28/2024
55
ms.topic: reference
66
title: AvoidUsingAllowUnencryptedAuthentication
77
---
@@ -11,14 +11,15 @@ title: AvoidUsingAllowUnencryptedAuthentication
1111

1212
## Description
1313

14-
Avoid using the `AllowUnencryptedAuthentication` switch on `Invoke-WebRequest`, `Invoke-RestMethod`, and other webrequest cmdlets, which sends credentials and secrets over unencrypted connections.
15-
This should be avoided except for compatability with legacy systems.
14+
Avoid using the **AllowUnencryptedAuthentication** parameter of `Invoke-WebRequest` and
15+
`Invoke-RestMethod`. When using this parameter, the cmdlets send credentials and secrets over
16+
unencrypted connections. This should be avoided except for compatibility with legacy systems.
1617

17-
For more details, see the documentation warning [here](https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest#-allowunencryptedauthentication).
18+
For more details, see [Invoke-RestMethod](xref:Microsoft.PowerShell.Utility.Invoke-RestMethod).
1819

1920
## How
2021

21-
Avoid using the `AllowUnencryptedAuthentication` switch.
22+
Avoid using the **AllowUnencryptedAuthentication** parameter.
2223

2324
## Example 1
2425

@@ -32,4 +33,4 @@ Invoke-WebRequest foo -AllowUnencryptedAuthentication
3233

3334
```powershell
3435
Invoke-WebRequest foo
35-
```
36+
```

docs/Rules/AvoidUsingPositionalParameters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Avoid Using Positional Parameters
33
ms.custom: PSSA v1.22.0
4-
ms.date: 06/28/2023
4+
ms.date: 02/13/2024
55
ms.topic: reference
66
title: AvoidUsingPositionalParameters
77
---

docs/Rules/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: List of PSScriptAnalyzer rules
33
ms.custom: PSSA v1.22.0
4-
ms.date: 06/28/2023
4+
ms.date: 02/13/2024
55
ms.topic: reference
66
title: List of PSScriptAnalyzer rules
77
---

docs/Rules/ReservedParams.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Reserved Parameters
33
ms.custom: PSSA v1.22.0
4-
ms.date: 06/28/2023
4+
ms.date: 03/06/2024
55
ms.topic: reference
66
title: ReservedParams
77
---
@@ -11,9 +11,9 @@ title: ReservedParams
1111

1212
## Description
1313

14-
You cannot use [reserved common parameters][01] in an advanced function.
15-
16-
[01]: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
14+
You can't redefine [common parameters][01] in an advanced function. Using the `CmdletBinding` or
15+
`Parameter` attributes creates an advanced function. The common parameters are are automatically
16+
available in advanced functions, so you can't redefine them.
1717

1818
## How
1919

@@ -48,3 +48,5 @@ function Test
4848
)
4949
}
5050
```
51+
52+
[01]: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters

docs/Rules/UseDeclaredVarsMoreThanAssignments.md

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Extra Variables
33
ms.custom: PSSA v1.22.0
4-
ms.date: 06/28/2023
4+
ms.date: 03/06/2024
55
ms.topic: reference
66
title: UseDeclaredVarsMoreThanAssignments
77
---
@@ -44,10 +44,13 @@ function Test
4444
}
4545
```
4646

47-
### Special case
47+
### Special cases
4848

49-
The following example triggers the **PSUseDeclaredVarsMoreThanAssignments** warning because `$bar`
50-
is not used within the scriptblock where it was defined.
49+
The following examples trigger the **PSUseDeclaredVarsMoreThanAssignments** warning. This behavior
50+
is a limitation of the rule. There is no way to avoid these false positive warnings.
51+
52+
In this case, the warning is triggered because `$bar` is not used within the scriptblock where it
53+
was defined.
5154

5255
```powershell
5356
$foo | ForEach-Object {
@@ -60,3 +63,11 @@ if($bar){
6063
Write-Host 'Collection contained a false case.'
6164
}
6265
```
66+
67+
In the next example, the warning is triggered because `$errResult` isn't recognized as being used in
68+
the `Write-Host` command.
69+
70+
```powershell
71+
$errResult = $null
72+
Write-Host 'Ugh:' -ErrorVariable errResult
73+
```

docs/Rules/UseSingularNouns.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Cmdlet Singular Noun
33
ms.custom: PSSA v1.22.0
4-
ms.date: 06/28/2023
4+
ms.date: 02/13/2024
55
ms.topic: reference
66
title: UseSingularNouns
77
---

0 commit comments

Comments
 (0)