File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff 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```
4247Export-ModuleMember -Function (FunctionName)
You can’t perform that action at this time.
0 commit comments