-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPSScriptAnalyzerSettings.psd1
More file actions
94 lines (77 loc) · 3.33 KB
/
PSScriptAnalyzerSettings.psd1
File metadata and controls
94 lines (77 loc) · 3.33 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@{
# Keep signal high for a shared repo. Info-level findings tend to create noise.
Severity = @('Error', 'Warning')
# Rules excluded intentionally due to common false-positives or known analyzer issues.
ExcludeRules = @(
# Frequently noisy with splatting, scriptblocks, and dynamic parameter patterns.
'PSReviewUnusedParameter'
# Known to be unstable/buggy in some analyzer versions/patterns.
'AvoidReservedCharInCmdlet'
)
Rules = @{
# ---------------------------------------------------------------------
# Compatibility (PS 5.1 + PS 7)
# ---------------------------------------------------------------------
PSUseCompatibleSyntax = @{
Enable = $true
# Enforces syntax that works in BOTH Windows PowerShell 5.1 and PowerShell 7+.
TargetVersions = @('5.1', '7.0')
}
# ---------------------------------------------------------------------
# Authoring / maintainability
# ---------------------------------------------------------------------
PSUseApprovedVerbs = @{
Enable = $true
}
PSProvideCommentHelp = @{
Enable = $true
# Public surface should be documented; internal helpers are often too noisy to enforce globally.
ExportedOnly = $true
}
PSUseShouldProcessForStateChangingFunctions = @{
Enable = $true
}
PSAvoidGlobalVars = @{
Enable = $true
}
# ---------------------------------------------------------------------
# Security / unsafe patterns
# ---------------------------------------------------------------------
PSAvoidUsingInvokeExpression = @{
Enable = $true
}
PSAvoidUsingConvertToSecureStringWithPlainText = @{
Enable = $true
}
PSAvoidUsingPlainTextForPassword = @{
Enable = $true
}
# ---------------------------------------------------------------------
# Team-consistent readability (minimal, to reduce diff churn)
# ---------------------------------------------------------------------
PSAvoidUsingCmdletAliases = @{
Enable = $true
}
PSAvoidUsingWriteHost = @{
Enable = $true
}
PSUseConsistentIndentation = @{
Enable = $true
IndentationSize = 4
Kind = 'space'
}
PSPlaceOpenBrace = @{
Enable = $true
OnSameLine = $true
IgnoreOneLineBlock = $true
}
PSPlaceCloseBrace = @{
Enable = $true
NoEmptyLineBefore = $true
IgnoreOneLineBlock = $true
}
# Intentionally NOT forcing these (higher churn / opinionated style policing):
PSUseConsistentWhitespace = @{ Enable = $false }
PSAlignAssignmentStatement = @{ Enable = $false }
}
}