This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
PSScriptAnalyzerSettings.psd1
executable file
·73 lines (64 loc) · 2.26 KB
/
PSScriptAnalyzerSettings.psd1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#requires -Version 1.0
<#
Use Severity when you want to limit the generated diagnostic records to a subset of: Error, Warning and Information.
Uncomment the following line if you only want Errors and Warnings but not Information diagnostic records.
SAMPLE:
Severity = @(
'Error',
'Warning'
)
Use IncludeRules when you want to run only a subset of the default rule set.
SAMPLE:
IncludeRules = @(
'PSAvoidDefaultValueSwitchParameter',
'PSMissingModuleManifestField',
'PSReservedCmdletChar',
'PSReservedParams',
'PSShouldProcess',
'PSUseApprovedVerbs',
'PSUseDeclaredVarsMoreThanAssigments',
'PSUseCompatibleCmdlets'
)
Use ExcludeRules when you want to run most of the default set of rules except for a few rules you wish to "exclude".
Note: if a rule is in both IncludeRules and ExcludeRules, the rule will be excluded.
SAMPLE:
ExcludeRules = @(
'PSAvoidTrailingWhitespace',
'PSUseDeclaredVarsMoreThanAssignments'
)
You can use the following entry to supply parameters to rules that take parameters.
For instance, the PSAvoidUsingCmdletAliases rule takes a whitelist for aliases you want to allow.
SAMPLE:
Rules = @{
# https://github.com/PowerShell/PSScriptAnalyzer/blob/260a573e5e3f1ce8580c6ceb6f9089c7f1aadbc6/RuleDocumentation/UseCompatibleCmdlets.md
PSUseCompatibleCmdlets = @{Compatibility = @(
"core-6.0.0-alpha-linux",
"core-6.0.0-alpha-windows",
"core-6.0.0-alpha-osx"
)}
}
#>
@{
Severity = @(
'Error',
'Warning'
)
ExcludeRules = @(
'PSAvoidUsingUserNameAndPassWordParams',
'PSAvoidUsingPlainTextForPassword',
'PSAvoidTrailingWhitespace',
'PSUseDeclaredVarsMoreThanAssignments',
'PSUseSingularNouns',
'PSAvoidGlobalVars'
)
Rules = @{
PSUseCompatibleCmdlets = @{
Compatibility = @(
'core-6.0.2-alpha-linux',
'core-6.0.2-alpha-windows',
'core-6.0.2-alpha-osx',
'desktop-5.1.17763.134-windows'
)
}
}
}