Skip to content

Commit 483afd0

Browse files
Update .psscriptanalyzer.psd1
Signed-off-by: LUIZ HAMILTON ROBERTO DA SILVA <[email protected]>
1 parent a604253 commit 483afd0

1 file changed

Lines changed: 24 additions & 52 deletions

File tree

.psscriptanalyzer.psd1

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,29 @@
11
# .psscriptanalyzer.psd1
2-
# VALID for PSScriptAnalyzer 1.24.0
3-
# Notes:
4-
# - No RuleSeverity (NOT supported by PSA 1.24.0 settings hashtable)
5-
# - Repo-wide rules live here; “severity buckets” are enforced by your YAML (two-pass PSA run)
6-
# - GUI-only suppressions and folder scoping are enforced by your YAML (post-filter), not here
7-
82
@{
9-
# =========================================================================
10-
# What rules are active across the repo (all folders + subfolders)
11-
# =========================================================================
12-
IncludeRules = @(
13-
# --- Formatting (safe autofix) ---
14-
'PSUseConsistentIndentation'
15-
'PSUseConsistentWhitespace'
3+
# IMPORTANT (PSScriptAnalyzer 1.24.0):
4+
# Valid top-level keys are:
5+
# CustomRulePath, ExcludeRules, IncludeRules, IncludeDefaultRules,
6+
# RecurseCustomRulePath, Rules, Severity
167

17-
# --- Style / maintainability ---
18-
'PSAvoidUsingCmdletAliases'
19-
'PSUseDeclaredVarsMoreThanAssignments'
20-
'PSAvoidGlobalVars'
8+
IncludeDefaultRules = $true
219

22-
# --- Safety / security ---
23-
'PSAvoidUsingWriteHost'
24-
'PSAvoidUsingInvokeExpression'
25-
'PSAvoidUsingEmptyCatchBlock'
10+
# Default severities to return (workflow gates on "Error" only)
11+
Severity = @('Error','Warning','Information')
2612

27-
# --- Correctness / state-changing ---
28-
'PSUseShouldProcessForStateChangingFunctions'
13+
# Keep this list focused and stable (corporate baseline).
14+
IncludeRules = @(
15+
'PSAvoidUsingCmdletAliases',
16+
'PSAvoidUsingWriteHost',
17+
'PSAvoidUsingInvokeExpression',
18+
'PSAvoidUsingEmptyCatchBlock',
19+
'PSAvoidGlobalVars',
20+
'PSUseDeclaredVarsMoreThanAssignments',
21+
'PSUseShouldProcessForStateChangingFunctions',
22+
'PSUseConsistentIndentation',
23+
'PSUseConsistentWhitespace'
2924
)
3025

31-
# =========================================================================
32-
# Rule configuration (only valid keys for PSA 1.24.0)
33-
# =========================================================================
3426
Rules = @{
35-
# -------------------------
36-
# Formatting config
37-
# -------------------------
3827
PSUseConsistentIndentation = @{
3928
Enable = $true
4029
Kind = 'space'
@@ -51,49 +40,32 @@
5140
CheckSeparator = $true
5241
}
5342

54-
# -------------------------
55-
# Hygiene / maintainability
56-
# -------------------------
57-
PSAvoidUsingCmdletAliases = @{
43+
PSAvoidUsingWriteHost = @{
5844
Enable = $true
5945
}
6046

61-
PSUseDeclaredVarsMoreThanAssignments = @{
47+
PSAvoidUsingCmdletAliases = @{
6248
Enable = $true
6349
}
6450

65-
PSAvoidGlobalVars = @{
51+
PSAvoidUsingInvokeExpression = @{
6652
Enable = $true
6753
}
6854

69-
# -------------------------
70-
# Safety / security
71-
# -------------------------
72-
PSAvoidUsingWriteHost = @{
55+
PSAvoidUsingEmptyCatchBlock = @{
7356
Enable = $true
7457
}
7558

76-
PSAvoidUsingInvokeExpression = @{
59+
PSAvoidGlobalVars = @{
7760
Enable = $true
7861
}
7962

80-
PSAvoidUsingEmptyCatchBlock = @{
63+
PSUseDeclaredVarsMoreThanAssignments = @{
8164
Enable = $true
8265
}
8366

84-
# -------------------------
85-
# Correctness
86-
# -------------------------
8767
PSUseShouldProcessForStateChangingFunctions = @{
8868
Enable = $true
8969
}
9070
}
91-
92-
# =========================================================================
93-
# Optional repo-wide Severity gate (supported key)
94-
# =========================================================================
95-
# This controls which severities PSA emits when *you* do not pass -Severity.
96-
# Your YAML already runs PSA in two passes (Error pass + Warning pass),
97-
# so this is mostly a safe default.
98-
Severity = @('Error','Warning')
9971
}

0 commit comments

Comments
 (0)