File tree 3 files changed +61
-0
lines changed
reference/docs-conceptual
3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ description : Avoid semicolons as line terminators
3
+ ms.custom : PSSA v1.21.0
4
+ ms.date : 07/25/2022
5
+ ms.topic : reference
6
+ title : AvoidSemicolonsAsLineTerminators
7
+ ---
8
+
9
+ # AvoidSemicolonsAsLineTerminators
10
+
11
+ ** Severity Level: Warning**
12
+
13
+ ## Description
14
+
15
+ Lines should not end with a semicolon.
16
+
17
+ > [ !NOTE]
18
+ > This rule is not enabled by default. The user needs to enable it through settings.
19
+
20
+ ## Example
21
+
22
+ ### Wrong
23
+
24
+ ``` powershell
25
+ Install-Module -Name PSScriptAnalyzer; $a = 1 + $b;
26
+ ```
27
+
28
+ ``` powershell
29
+ Install-Module -Name PSScriptAnalyzer;
30
+ $a = 1 + $b
31
+ ```
32
+
33
+ ### Correct
34
+
35
+ ``` powershell
36
+ Install-Module -Name PSScriptAnalyzer; $a = 1 + $b
37
+ ```
38
+
39
+ ``` powershell
40
+ Install-Module -Name PSScriptAnalyzer
41
+ $a = 1 + $b
42
+ ```
43
+
44
+ ## Configuration
45
+
46
+ ``` powershell
47
+ Rules = @{
48
+ PSAvoidSemicolonsAsLineTerminators = @{
49
+ Enable = $true
50
+ }
51
+ }
52
+ ```
53
+
54
+ ### Parameters
55
+
56
+ #### Enable: bool (Default value is ` $false ` )
57
+
58
+ Enable or disable the rule during ScriptAnalyzer invocation.
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ The PSScriptAnalyzer contains the following rule definitions.
23
23
| [ AvoidMultipleTypeAttributes<sup >1</sup >] ( ./AvoidMultipleTypeAttributes.md ) | Warning | Yes | |
24
24
| [ AvoidNullOrEmptyHelpMessageAttribute] ( ./AvoidNullOrEmptyHelpMessageAttribute.md ) | Warning | Yes | |
25
25
| [ AvoidOverwritingBuiltInCmdlets] ( ./AvoidOverwritingBuiltInCmdlets.md ) | Warning | Yes | Yes |
26
+ | [ AvoidSemicolonsAsLineTerminators] ( ./AvoidSemicolonsAsLineTerminators.md ) | Warning | No | |
26
27
| [ AvoidShouldContinueWithoutForce] ( ./AvoidShouldContinueWithoutForce.md ) | Warning | Yes | |
27
28
| [ AvoidTrailingWhitespace] ( ./AvoidTrailingWhitespace.md ) | Warning | Yes | |
28
29
| [ AvoidUsingCmdletAliases] ( ./AvoidUsingCmdletAliases.md ) | Warning | Yes | Yes<sup >2</sup > |
Original file line number Diff line number Diff line change 65
65
href : PSScriptAnalyzer/Rules/AvoidNullOrEmptyHelpMessageAttribute.md
66
66
- name : AvoidOverwritingBuiltInCmdlets
67
67
href : PSScriptAnalyzer/Rules/AvoidOverwritingBuiltInCmdlets.md
68
+ - name : AvoidSemicolonsAsLineTerminators
69
+ href : PSScriptAnalyzer/Rules/AvoidSemicolonsAsLineTerminators.md
68
70
- name : AvoidShouldContinueWithoutForce
69
71
href : PSScriptAnalyzer/Rules/AvoidShouldContinueWithoutForce.md
70
72
- name : AvoidTrailingWhitespace
You can’t perform that action at this time.
0 commit comments