-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSScriptAnalyzerSettings.psd1
More file actions
78 lines (70 loc) · 3.45 KB
/
Copy pathPSScriptAnalyzerSettings.psd1
File metadata and controls
78 lines (70 loc) · 3.45 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
@{
# PSScriptAnalyzer settings for this repository.
# Customize 'IncludeRules', 'ExcludeRules', and 'Rules' to suit your style.
# See: https://github.com/PowerShell/PSScriptAnalyzer/blob/main/Documentation/DetectingIssues.md
# Uncomment and list the rules you want to explicitly include
IncludeRules = @(
# Security-focused rules
'PSAvoidUsingConvertToSecureStringWithPlainText',
'PSAvoidUsingPlainTextForPassword',
'PSAvoidUsingUserNameAndPasswordParams',
'PSUsePSCredentialType'
)
# List rules to exclude (rule names are case-sensitive). These are disabled
# because interactive profile code intentionally uses aliases, Write-Host,
# non-approved verbs for tiny wrapper functions, and other patterns that are
# noisy in this context.
ExcludeRules = @(
'PSUseShouldProcessForStateChangingFunctions',
'PSAvoidUsingEmptyCatchBlock',
'PSUseBOMForUnicodeEncodedFile',
'PSUseDeclaredVarsMoreThanAssignments',
'PSUseApprovedVerbs',
'PSAvoidUsingWriteHost',
'PSAvoidUsingComputerNameHardcoded'
)
# Per-rule configuration (Enable = $true/$false; Severity = 'Error'|'Warning'|'Information')
Rules = @{
# Profiles frequently use short helper aliases and interactive Write-Host.
# Disable the alias avoidance rule to avoid noisy reports for intentional aliases.
'PSAvoidUsingCmdletAliases' = @{ Enable = $false }
# Allow Write-Host in interactive helpers; set to $true to re-enable rule.
'PSAvoidUsingWriteHost' = @{ Enable = $false }
}
}
# Note: Per-file suppressions should be added directly in code using
# [Diagnostics.CodeAnalysis.SuppressMessageAttribute()] attributes, not in settings file.
# The rules listed above in ExcludeRules are already globally excluded.
# - These are intentional shortcuts for interactive use
# - Consider: Keep excluded for profile.d scripts, but could enable for utility scripts
#
# PSAvoidUsingWriteHost
# - Write-Host is appropriate for interactive profile output
# - Profile code is meant for user interaction, not programmatic consumption
# - Consider: Keep excluded for profile.d scripts, but could enable for utility scripts
#
# PSAvoidUsingComputerNameHardcoded
# - Profile code may reference localhost or specific machine names for local configuration
# - Hardcoded computer names are acceptable in profile context
# - Consider: Could be enabled for utility scripts that should be portable
ExcludeRules = @(
'PSUseShouldProcessForStateChangingFunctions',
'PSAvoidUsingEmptyCatchBlock',
'PSUseBOMForUnicodeEncodedFile',
'PSUseDeclaredVarsMoreThanAssignments',
'PSUseApprovedVerbs',
'PSAvoidUsingWriteHost',
'PSAvoidUsingComputerNameHardcoded'
)
# Per-rule configuration (Enable = $true/$false; Severity = 'Error'|'Warning'|'Information')
Rules = @{
# Profiles frequently use short helper aliases and interactive Write-Host.
# Disable the alias avoidance rule to avoid noisy reports for intentional aliases.
'PSAvoidUsingCmdletAliases' = @{ Enable = $false }
# Allow Write-Host in interactive helpers; set to $true to re-enable rule.
'PSAvoidUsingWriteHost' = @{ Enable = $false }
}
}
# Note: Per-file suppressions should be added directly in code using
# [Diagnostics.CodeAnalysis.SuppressMessageAttribute()] attributes, not in settings file.
# The rules listed above in ExcludeRules are already globally excluded.