-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSScriptAnalyzerSettings.psd1
More file actions
56 lines (46 loc) · 1.67 KB
/
Copy pathPSScriptAnalyzerSettings.psd1
File metadata and controls
56 lines (46 loc) · 1.67 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
# PSScriptAnalyzer settings for PowerShell-DevKit
# This file customizes which rules to run and their severity
@{
# Use all default rules from PSGallery settings as baseline
IncludeDefaultRules = $true
# Severity levels to include
Severity = @('Error', 'Warning', 'Information')
# Rules to exclude (customize based on your project needs)
ExcludeRules = @(
# Profile-specific exclusions
'PSAvoidGlobalVars', # Profile often needs global scope
'PSUseDeclaredVarsMoreThanAssignments' # Profile has intentional one-time assignments
)
# Rules to include (in addition to defaults)
IncludeRules = @(
'PSUseCompatibleCmdlets', # Ensure cmdlet compatibility
'PSUseCompatibleSyntax', # Ensure syntax compatibility
'PSUseCompatibleCommands' # Ensure command compatibility
)
# Custom rule configurations
Rules = @{
# PowerShell version compatibility
PSUseCompatibleSyntax = @{
Enable = $true
TargetVersions = @('7.0', '7.1', '7.2', '7.3', '7.4')
}
PSUseCompatibleCmdlets = @{
Enable = $true
Compatibility = @('core-7.0.0-windows', 'core-7.0.0-linux', 'core-7.0.0-macos')
}
# Best practices
PSAvoidUsingCmdletAliases = @{
Enable = $true
Whitelist = @('cd', 'ls', 'cat', 'man') # Common aliases that are acceptable
}
PSUseCmdletCorrectly = @{
Enable = $true
}
PSAvoidUsingPositionalParameters = @{
Enable = $true
}
PSUseOutputTypeCorrectly = @{
Enable = $true
}
}
}