From 471b727ea117651d548490e66b3cf7f4864e074d Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 17 Feb 2026 13:19:23 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20coding=20standa?= =?UTF-8?q?rds=20documentation=20for=20GitHub=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../copilot-instructions.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) rename CodingStandard.md => .github/copilot-instructions.md (91%) diff --git a/CodingStandard.md b/.github/copilot-instructions.md similarity index 91% rename from CodingStandard.md rename to .github/copilot-instructions.md index 4d5a05624..33ad04d5c 100644 --- a/CodingStandard.md +++ b/.github/copilot-instructions.md @@ -31,9 +31,17 @@ Additions or adjustments to those defaults are covered in this document to ensur - Private function name format: **`Verb-GitHubNoun`** (same style but no aliases). - **`Get-`** functions must **not** include `[CmdletBinding(SupportsShouldProcess)]`. You only use `SupportsShouldProcess` on commands that change or remove data (`Set-`, `Remove-`, `Add-`, etc.). -- **Default Parameter Sets** - - Do **not** declare `DefaultParameterSetName = '__AllParameterSets'`. - - Only specify a `DefaultParameterSetName` if it is actually different from the first parameter set. +- **Parameter Set Naming** + - When a function has only one parameter set, a name is not needed and `DefaultParameterSetName` should not be set. + - When a function has multiple parameter sets, **every** parameter set **must** have a descriptive name that tells + the user what will happen when they use it. Set `DefaultParameterSetName` in the `[CmdletBinding()]` attribute to + the most commonly used parameter set. + - Do **not** use generic names like `'__AllParameterSets'` or `'Default'`. + - Name parameter sets after the action or scope they represent, e.g. `'List repositories for authenticated user'`, + `'Get a repository'`, `'List organization repositories'`. + - For public functions that call private functions, use the **synopsis** of the called private function as the + parameter set name (e.g. if the private function's synopsis is `List repositories for a user`, the parameter set + name becomes `'List repositories for a user'`). - **One API Call = One Function** - If you find that a single function is handling multiple distinct API calls, split it into multiple functions.