diff --git a/reference/breadcrumb/toc.yml b/reference/breadcrumb/toc.yml index 1cce9f4..cf6a3c1 100644 --- a/reference/breadcrumb/toc.yml +++ b/reference/breadcrumb/toc.yml @@ -1,25 +1,25 @@ -- name: Docs - tocHref: / - topicHref: / - items: - - name: PowerShell - tocHref: /powershell/ - topicHref: /powershell +items: + - name: Docs + tocHref: / + topicHref: / items: - - name: Utility Modules - tocHref: /powershell/utility-modules/ - topicHref: /powershell/utility-modules/overview - items: - - name: Crescendo - tocHref: /powershell/module/crescendo/ - topicHref: /powershell/utility-modules/crescendo/overview - - name: PlatyPS - tocHref: /powershell/module/platyps/ - topicHref: /powershell/utility-modules/platyps/overview - - name: PSScriptAnalyzer - tocHref: /powershell/module/psscriptanalyzer/ - topicHref: /powershell/utility-modules/psscriptanalyzer/overview - - name: SecretManagement and SecretStore - tocHref: /powershell/module/secretmanagement/ - topicHref: /powershell/utility-modules/secretmanagement/overview - + - name: PowerShell + tocHref: /powershell/ + topicHref: /powershell + items: + - name: Utility Modules + tocHref: /powershell/utility-modules/ + topicHref: /powershell/utility-modules/overview + items: + - name: Crescendo + tocHref: /powershell/module/crescendo/ + topicHref: /powershell/utility-modules/crescendo/overview + - name: PlatyPS + tocHref: /powershell/module/platyps/ + topicHref: /powershell/utility-modules/platyps/overview + - name: PSScriptAnalyzer + tocHref: /powershell/module/psscriptanalyzer/ + topicHref: /powershell/utility-modules/psscriptanalyzer/overview + - name: SecretManagement and SecretStore + tocHref: /powershell/module/secretmanagement/ + topicHref: /powershell/utility-modules/secretmanagement/overview diff --git a/reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidSemicolonsAsLineTerminators.md b/reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidSemicolonsAsLineTerminators.md new file mode 100644 index 0000000..09a8a1b --- /dev/null +++ b/reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidSemicolonsAsLineTerminators.md @@ -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. diff --git a/reference/docs-conceptual/PSScriptAnalyzer/Rules/README.md b/reference/docs-conceptual/PSScriptAnalyzer/Rules/README.md index e695e70..ee86175 100644 --- a/reference/docs-conceptual/PSScriptAnalyzer/Rules/README.md +++ b/reference/docs-conceptual/PSScriptAnalyzer/Rules/README.md @@ -23,6 +23,7 @@ The PSScriptAnalyzer contains the following rule definitions. | [AvoidMultipleTypeAttributes1](./AvoidMultipleTypeAttributes.md) | Warning | Yes | | | [AvoidNullOrEmptyHelpMessageAttribute](./AvoidNullOrEmptyHelpMessageAttribute.md) | Warning | Yes | | | [AvoidOverwritingBuiltInCmdlets](./AvoidOverwritingBuiltInCmdlets.md) | Warning | Yes | Yes | +| [AvoidSemicolonsAsLineTerminators](./AvoidSemicolonsAsLineTerminators.md) | Warning | No | | | [AvoidShouldContinueWithoutForce](./AvoidShouldContinueWithoutForce.md) | Warning | Yes | | | [AvoidTrailingWhitespace](./AvoidTrailingWhitespace.md) | Warning | Yes | | | [AvoidUsingCmdletAliases](./AvoidUsingCmdletAliases.md) | Warning | Yes | Yes2 | diff --git a/reference/docs-conceptual/toc.yml b/reference/docs-conceptual/toc.yml index 2f176de..a3c26b6 100644 --- a/reference/docs-conceptual/toc.yml +++ b/reference/docs-conceptual/toc.yml @@ -65,6 +65,8 @@ items: href: PSScriptAnalyzer/Rules/AvoidNullOrEmptyHelpMessageAttribute.md - name: AvoidOverwritingBuiltInCmdlets href: PSScriptAnalyzer/Rules/AvoidOverwritingBuiltInCmdlets.md + - name: AvoidSemicolonsAsLineTerminators + href: PSScriptAnalyzer/Rules/AvoidSemicolonsAsLineTerminators.md - name: AvoidShouldContinueWithoutForce href: PSScriptAnalyzer/Rules/AvoidShouldContinueWithoutForce.md - name: AvoidTrailingWhitespace