forked from MicrosoftDocs/PowerShell-Docs-Modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…tDocs#86) This change adds the new `AvoidSemiColonsAsLineTerminators` rule documentation to PSScriptAnalyzer. - Resolves MicrosoftDocs#70 - Fixes AB#4588
- Loading branch information
1 parent
ac69690
commit c6934de
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...ence/docs-conceptual/PSScriptAnalyzer/Rules/AvoidSemicolonsAsLineTerminators.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
description: Avoid semicolons as line terminators | ||
ms.custom: PSSA v1.21.0 | ||
ms.date: 07/25/2022 | ||
ms.topic: reference | ||
title: AvoidSemicolonsAsLineTerminators | ||
--- | ||
|
||
# AvoidSemicolonsAsLineTerminators | ||
|
||
**Severity Level: Warning** | ||
|
||
## Description | ||
|
||
Lines should not end with a semicolon. | ||
|
||
> [!NOTE] | ||
> This rule is not enabled by default. The user needs to enable it through settings. | ||
## Example | ||
|
||
### Wrong | ||
|
||
```powershell | ||
Install-Module -Name PSScriptAnalyzer; $a = 1 + $b; | ||
``` | ||
|
||
```powershell | ||
Install-Module -Name PSScriptAnalyzer; | ||
$a = 1 + $b | ||
``` | ||
|
||
### Correct | ||
|
||
```powershell | ||
Install-Module -Name PSScriptAnalyzer; $a = 1 + $b | ||
``` | ||
|
||
```powershell | ||
Install-Module -Name PSScriptAnalyzer | ||
$a = 1 + $b | ||
``` | ||
|
||
## Configuration | ||
|
||
```powershell | ||
Rules = @{ | ||
PSAvoidSemicolonsAsLineTerminators = @{ | ||
Enable = $true | ||
} | ||
} | ||
``` | ||
|
||
### Parameters | ||
|
||
#### Enable: bool (Default value is `$false`) | ||
|
||
Enable or disable the rule during ScriptAnalyzer invocation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters