|
1 | | -# .psscriptanalyzer.psd1 |
2 | 1 | @{ |
3 | | - # Reduce noise: only show Error + Warning by default |
4 | | - IncludeDefaultRules = $true |
5 | | - Severity = @('Error','Warning') |
| 2 | + # Goal: high-signal findings only (quality/security). No style noise. |
| 3 | + # This settings file is intended for "report-only" CI runs. |
6 | 4 |
|
7 | | - # Focused include list: high-signal rules |
| 5 | + # Do NOT include the full default ruleset (too noisy for large repos) |
| 6 | + IncludeDefaultRules = $false |
| 7 | + |
| 8 | + # Only report these severities |
| 9 | + Severity = @('Error','Warning') |
| 10 | + |
| 11 | + # Curated high-signal rules (quality/security) |
8 | 12 | IncludeRules = @( |
| 13 | + # Security / execution safety |
9 | 14 | 'PSAvoidUsingInvokeExpression', |
| 15 | + |
| 16 | + # Reliability / observability |
10 | 17 | 'PSAvoidUsingEmptyCatchBlock', |
11 | | - 'PSAvoidGlobalVars', |
12 | | - 'PSUseShouldProcessForStateChangingFunctions', |
| 18 | + |
| 19 | + # Professional output (avoid Write-Host in tooling) |
13 | 20 | 'PSAvoidUsingWriteHost', |
| 21 | + |
| 22 | + # Maintainability / correctness |
14 | 23 | 'PSAvoidUsingCmdletAliases', |
15 | | - 'PSUseConsistentIndentation', |
16 | | - 'PSUseConsistentWhitespace' |
| 24 | + |
| 25 | + # Safety for state-changing functions (WhatIf/Confirm) |
| 26 | + 'PSUseShouldProcessForStateChangingFunctions' |
17 | 27 | ) |
18 | 28 |
|
19 | 29 | Rules = @{ |
20 | | - # --- High-signal rules kept as Warning/Error (default severities) --- |
21 | | - PSAvoidUsingInvokeExpression = @{ Enable = $true } |
22 | | - PSAvoidUsingEmptyCatchBlock = @{ Enable = $true } |
23 | | - PSAvoidGlobalVars = @{ Enable = $true } |
24 | | - PSUseShouldProcessForStateChangingFunctions = @{ Enable = $true } |
25 | | - PSAvoidUsingWriteHost = @{ Enable = $true } |
26 | | - PSAvoidUsingCmdletAliases = @{ Enable = $true } |
27 | | - |
28 | | - # --- Style rules: keep enabled but downgrade to Information (noise control) --- |
29 | | - PSUseConsistentIndentation = @{ |
30 | | - Enable = $true |
31 | | - Severity = 'Information' |
32 | | - Kind = 'space' |
33 | | - IndentationSize = 4 |
34 | | - PipelineIndentation = 'IncreaseIndentationForFirstPipeline' |
| 30 | + PSAvoidUsingInvokeExpression = @{ |
| 31 | + Enable = $true |
| 32 | + } |
| 33 | + |
| 34 | + PSAvoidUsingEmptyCatchBlock = @{ |
| 35 | + Enable = $true |
| 36 | + } |
| 37 | + |
| 38 | + PSAvoidUsingWriteHost = @{ |
| 39 | + Enable = $true |
| 40 | + } |
| 41 | + |
| 42 | + PSAvoidUsingCmdletAliases = @{ |
| 43 | + Enable = $true |
| 44 | + } |
| 45 | + |
| 46 | + PSUseShouldProcessForStateChangingFunctions = @{ |
| 47 | + Enable = $true |
35 | 48 | } |
36 | 49 |
|
| 50 | + # Explicitly disable style rules (noise) |
37 | 51 | PSUseConsistentWhitespace = @{ |
38 | | - Enable = $true |
39 | | - Severity = 'Information' |
40 | | - CheckInnerBrace = $true |
41 | | - CheckOpenBrace = $true |
42 | | - CheckOpenParen = $true |
43 | | - CheckOperator = $true |
44 | | - CheckSeparator = $true |
| 52 | + Enable = $false |
| 53 | + } |
| 54 | + |
| 55 | + PSUseConsistentIndentation = @{ |
| 56 | + Enable = $false |
| 57 | + } |
| 58 | + |
| 59 | + # Explicitly disable common GUI/script-state noise (optional but recommended for your goal) |
| 60 | + PSAvoidGlobalVars = @{ |
| 61 | + Enable = $false |
45 | 62 | } |
46 | 63 | } |
47 | 64 | } |
0 commit comments