@@ -20,7 +20,7 @@ This documentation serves as a basic guideline on how to define customized rules
20
20
21
21
- Output type should be DiagnosticRecord:
22
22
```
23
- [OutputType([Microsoft.Windows.Powershell .ScriptAnalyzer.Generic.DiagnosticRecord[]])]
23
+ [OutputType([Microsoft.Windows.PowerShell .ScriptAnalyzer.Generic.DiagnosticRecord[]])]
24
24
```
25
25
26
26
- Make sure each function takes either a Token or an Ast as a parameter
36
36
37
37
- DiagnosticRecord should have four properties: Message, Extent, RuleName and Severity
38
38
```
39
- $result = [Microsoft.Windows.Powershell .ScriptAnalyzer.Generic.DiagnosticRecord[]]@{"Message" = "This is a sample rule";
39
+ $result = [Microsoft.Windows.PowerShell .ScriptAnalyzer.Generic.DiagnosticRecord[]]@{"Message" = "This is a sample rule";
40
40
"Extent" = $ast.Extent;
41
41
"RuleName" = $PSCmdlet.MyInvocation.InvocationName;
42
42
"Severity" = "Warning"}
@@ -62,14 +62,14 @@ Export-ModuleMember -Function (FunctionName)
62
62
.INPUTS
63
63
[System.Management.Automation.Language.ScriptBlockAst]
64
64
.OUTPUTS
65
- [Microsoft.Windows.Powershell .ScriptAnalyzer.Generic.DiagnosticRecord[]]
65
+ [Microsoft.Windows.PowerShell .ScriptAnalyzer.Generic.DiagnosticRecord[]]
66
66
.NOTES
67
67
None
68
68
#>
69
69
function Measure-RequiresRunAsAdministrator
70
70
{
71
71
[CmdletBinding()]
72
- [OutputType([Microsoft.Windows.Powershell .ScriptAnalyzer.Generic.DiagnosticRecord[]])]
72
+ [OutputType([Microsoft.Windows.PowerShell .ScriptAnalyzer.Generic.DiagnosticRecord[]])]
73
73
Param
74
74
(
75
75
[Parameter(Mandatory = $true)]
@@ -127,7 +127,7 @@ function Measure-RequiresRunAsAdministrator
127
127
if ((!$ScriptBlockAst.ScriptRequirements.IsElevationRequired) -and
128
128
($methodAst.Count -ne 0) -and ($assignmentAst.Count -ne 0))
129
129
{
130
- $result = [Microsoft.Windows.Powershell .ScriptAnalyzer.Generic.DiagnosticRecord]@{"Message" = $Messages.MeasureRequiresRunAsAdministrator;
130
+ $result = [Microsoft.Windows.PowerShell .ScriptAnalyzer.Generic.DiagnosticRecord]@{"Message" = $Messages.MeasureRequiresRunAsAdministrator;
131
131
"Extent" = $assignmentAst.Extent;
132
132
"RuleName" = $PSCmdlet.MyInvocation.InvocationName;
133
133
"Severity" = "Information"}
@@ -138,7 +138,7 @@ function Measure-RequiresRunAsAdministrator
138
138
{
139
139
if (($methodAst.Count -ne 0) -and ($assignmentAst.Count -ne 0))
140
140
{
141
- $result = [Microsoft.Windows.Powershell .ScriptAnalyzer.Generic.DiagnosticRecord]@{"Message" = $Messages.MeasureRequiresRunAsAdministrator;
141
+ $result = [Microsoft.Windows.PowerShell .ScriptAnalyzer.Generic.DiagnosticRecord]@{"Message" = $Messages.MeasureRequiresRunAsAdministrator;
142
142
"Extent" = $assignmentAst.Extent;
143
143
"RuleName" = $PSCmdlet.MyInvocation.InvocationName;
144
144
"Severity" = "Information"}
0 commit comments