Skip to content

Commit b6c17b3

Browse files
committed
Update CustomizedRuleDocumentation.md
1 parent 4267cae commit b6c17b3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

CustomizedRuleDocumentation.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ PSScriptAnalyzer uses MEF(Managed Extensibility Framework) to import all rules d
44
This documentation serves as a basic guideline on how to define customized rules.
55

66
###Basics
7-
1. Functions should have comment-based help. Make sure .DESCRIPTION field is there, as it will be consumed as rule description for the customized rule.
7+
- Functions should have comment-based help. Make sure .DESCRIPTION field is there, as it will be consumed as rule description for the customized rule.
88
```
99
<#
1010
.SYNOPSIS
@@ -17,9 +17,10 @@ This documentation serves as a basic guideline on how to define customized rules
1717
.NOTES
1818
#>
1919
```
20-
2. Output type should be DiagnosticRecord:
20+
- Output type should be DiagnosticRecord:
2121
[OutputType([Microsoft.Windows.Powershell.ScriptAnalyzer.Generic.DiagnosticRecord[]])]
22-
3. Make sure each function takes either a Token or an Ast as a parameter
22+
23+
- Make sure each function takes either a Token or an Ast as a parameter
2324
```
2425
Param
2526
(
@@ -29,14 +30,14 @@ Param
2930
$testAst
3031
)
3132
```
32-
4. DiagnosticRecord should have four properties: Message, Extent, RuleName and Severity
33+
- DiagnosticRecord should have four properties: Message, Extent, RuleName and Severity
3334
```
3435
$result = [Microsoft.Windows.Powershell.ScriptAnalyzer.Generic.DiagnosticRecord[]]@{"Message" = "This is a sample rule";
3536
"Extent" = $ast.Extent;
3637
"RuleName" = $PSCmdlet.MyInvocation.InvocationName;
3738
"Severity" = "Warning"}
3839
```
39-
5. Make sure you export the function(s) at the end of the script using Export-ModuleMember
40+
- Make sure you export the function(s) at the end of the script using Export-ModuleMember
4041
```
4142
Export-ModuleMember -Function (FunctionName)
4243
```
@@ -149,4 +150,4 @@ function Measure-RequiresRunAsAdministrator
149150
}
150151
}
151152
```
152-
More examples can be found in *Tests\Engine\CommunityRules*
153+
More examples can be found in *Tests\Engine\CommunityRules*

0 commit comments

Comments
 (0)