Skip to content

Documentation update #942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ScriptRuleDocumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PSScriptAnalyzer uses MEF(Managed Extensibility Framework) to import all rules d

When calling Invoke-ScriptAnalyzer, users can specify custom rules using the parameter `CustomizedRulePath`.

The purpose of this documentation is to server as a basic guide on creating your own customized rules.
The purpose of this documentation is to serve as a basic guide on creating your own customized rules.

### Basics

Expand All @@ -29,7 +29,7 @@ The purpose of this documentation is to server as a basic guide on creating your
[OutputType([Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord[]])]
```

- Make sure each function takes either a Token or an Ast as a parameter
- Make sure each function takes either a Token array or an Ast as a parameter. The _Ast_ parameter name must end with 'Ast' and the _Token_ parameter name must end with 'Token'

``` PowerShell
Param
Expand All @@ -41,6 +41,16 @@ Param
)
```

``` PowerShell
Param
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.Language.Token[]]
$testToken
)
```

- DiagnosticRecord should have four properties: Message, Extent, RuleName and Severity

``` PowerShell
Expand Down