Skip to content

Commit 11ced68

Browse files
committed
Update CustomizedRuleDocumentation.md
1 parent b6c17b3 commit 11ced68

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CustomizedRuleDocumentation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ This documentation serves as a basic guideline on how to define customized rules
1717
.NOTES
1818
#>
1919
```
20+
2021
- Output type should be DiagnosticRecord:
22+
```
2123
[OutputType([Microsoft.Windows.Powershell.ScriptAnalyzer.Generic.DiagnosticRecord[]])]
24+
```
2225

2326
- Make sure each function takes either a Token or an Ast as a parameter
2427
```
@@ -30,13 +33,15 @@ Param
3033
$testAst
3134
)
3235
```
36+
3337
- DiagnosticRecord should have four properties: Message, Extent, RuleName and Severity
3438
```
3539
$result = [Microsoft.Windows.Powershell.ScriptAnalyzer.Generic.DiagnosticRecord[]]@{"Message" = "This is a sample rule";
3640
"Extent" = $ast.Extent;
3741
"RuleName" = $PSCmdlet.MyInvocation.InvocationName;
3842
"Severity" = "Warning"}
3943
```
44+
4045
- Make sure you export the function(s) at the end of the script using Export-ModuleMember
4146
```
4247
Export-ModuleMember -Function (FunctionName)

0 commit comments

Comments
 (0)