Skip to content

Commit 4284ec7

Browse files
docs(standards): add PSScriptAnalyzer decision path
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent ece10f3 commit 4284ec7

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/docs/Modules/Standards.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,18 @@ Source code is linted with PSScriptAnalyzer using the repo-level settings at `.g
338338
- `PSPlaceOpenBrace` / `PSPlaceCloseBrace` — OTBS brace style
339339
- `PSUseConsistentIndentation` — 4-space indentation
340340
- `PSUseConsistentWhitespace` — consistent spacing around operators, pipes, and separators
341+
342+
When a PSScriptAnalyzer rule flags code, follow this decision path:
343+
344+
1. Fix the issue.
345+
2. Reconsider the implementation approach or design.
346+
3. If the implementation is correct only for one file (case-specific deviation), add one file-level suppression attribute at the top of that file:
347+
348+
```powershell
349+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
350+
'PSUseDeclaredVarsMoreThanAssignments', '',
351+
Justification = 'Required for Pester tests'
352+
)]
353+
```
354+
355+
4. If the implementation is broadly correct across repositories, update linter settings (usually `.github/linters/.powershell-psscriptanalyzer.psd1`) instead of suppressing per file.

0 commit comments

Comments
 (0)