From 4284ec7e32144f20781ca5938843a19f4d1500ce Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Thu, 23 Jul 2026 17:45:23 +0200 Subject: [PATCH 1/2] docs(standards): add PSScriptAnalyzer decision path Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/docs/Modules/Standards.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/docs/Modules/Standards.md b/src/docs/Modules/Standards.md index 0651cc5..211cf19 100644 --- a/src/docs/Modules/Standards.md +++ b/src/docs/Modules/Standards.md @@ -338,3 +338,18 @@ Source code is linted with PSScriptAnalyzer using the repo-level settings at `.g - `PSPlaceOpenBrace` / `PSPlaceCloseBrace` — OTBS brace style - `PSUseConsistentIndentation` — 4-space indentation - `PSUseConsistentWhitespace` — consistent spacing around operators, pipes, and separators + +When a PSScriptAnalyzer rule flags code, follow this decision path: + +1. Fix the issue. +2. Reconsider the implementation approach or design. +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: + + ```powershell + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSUseDeclaredVarsMoreThanAssignments', '', + Justification = 'Required for Pester tests' + )] + ``` + +4. If the implementation is broadly correct across repositories, update linter settings (usually `.github/linters/.powershell-psscriptanalyzer.psd1`) instead of suppressing per file. From 39f2bf41b39197c39f2848b3186f883e9a56d45d Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Thu, 23 Jul 2026 18:25:45 +0200 Subject: [PATCH 2/2] Revert "docs(standards): add PSScriptAnalyzer decision path" This reverts commit 4284ec7e32144f20781ca5938843a19f4d1500ce. --- src/docs/Modules/Standards.md | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/docs/Modules/Standards.md b/src/docs/Modules/Standards.md index 211cf19..0651cc5 100644 --- a/src/docs/Modules/Standards.md +++ b/src/docs/Modules/Standards.md @@ -338,18 +338,3 @@ Source code is linted with PSScriptAnalyzer using the repo-level settings at `.g - `PSPlaceOpenBrace` / `PSPlaceCloseBrace` — OTBS brace style - `PSUseConsistentIndentation` — 4-space indentation - `PSUseConsistentWhitespace` — consistent spacing around operators, pipes, and separators - -When a PSScriptAnalyzer rule flags code, follow this decision path: - -1. Fix the issue. -2. Reconsider the implementation approach or design. -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: - - ```powershell - [Diagnostics.CodeAnalysis.SuppressMessageAttribute( - 'PSUseDeclaredVarsMoreThanAssignments', '', - Justification = 'Required for Pester tests' - )] - ``` - -4. If the implementation is broadly correct across repositories, update linter settings (usually `.github/linters/.powershell-psscriptanalyzer.psd1`) instead of suppressing per file.