Skip to content

Commit b8d4d6b

Browse files
committed
Merge pull request #175 from PowerShell/NewRuleDocumentation
Add rule documentation for ProvideDefaultParameter
2 parents a848091 + 8e1b187 commit b8d4d6b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#ProvideDefaultParameterValue
2+
**Severity Level: Warning**
3+
4+
5+
##Description
6+
Parameters must have a default value as uninitialized parameters will lead to potential bugs in the scripts.
7+
8+
##How to Fix
9+
10+
To fix a violation of this rule, please specify a default value for all parameters.
11+
12+
##Example
13+
14+
Wrong:
15+
16+
```
17+
function Test($Param1)
18+
{
19+
$Param1
20+
}
21+
```
22+
23+
Correct:
24+
25+
```
26+
function Test($Param1 = $null)
27+
{
28+
$Param1
29+
}
30+
```

0 commit comments

Comments
 (0)