From a903483864ce4cdf327fe1543048f5b1242d5d6d Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 19 Jul 2026 18:35:52 +0200 Subject: [PATCH 1/3] Add rule against nested helper functions Document that helper logic must be implemented as separate private function files rather than nested/internal helper functions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/docs/Modules/Standards.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/docs/Modules/Standards.md b/src/docs/Modules/Standards.md index 8b72597..028c4fd 100644 --- a/src/docs/Modules/Standards.md +++ b/src/docs/Modules/Standards.md @@ -57,6 +57,7 @@ Layout rules: - No pipeline input. - No defaulting from context — public callers resolve before calling. - Required inputs declared as mandatory. +- No nested helper functions. If logic needs a helper, create it as a separate private function file under `src/functions/private//`. ## SOLID applied From cba6b3bd6051f942c656cda7651fac3550e4955c Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 19 Jul 2026 18:42:33 +0200 Subject: [PATCH 2/3] Apply no-nested-functions rule to all functions Move the nested helper guidance from the private-functions section to general layout rules so it clearly applies to all functions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/docs/Modules/Standards.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/Modules/Standards.md b/src/docs/Modules/Standards.md index 028c4fd..ca9cc16 100644 --- a/src/docs/Modules/Standards.md +++ b/src/docs/Modules/Standards.md @@ -42,6 +42,7 @@ Layout rules: - **One declaration per file.** Filename matches the declared symbol exactly, including casing. - **Group by domain.** Use resource or behaviour groups — not verb folders, not endpoint paths. - **Mirror public and private domains.** Public command under `src/functions/public/Projects/` has related private helpers under `src/functions/private/Projects/`. +- **No nested functions.** Do not define helper functions inside other functions. Put helper logic in separate private function files under `src/functions/private//`. - **Declare dependencies where they are used.** Use `#Requires -Modules ` at the top of each function file that needs an external module. Do not add `RequiredModules` to `src/manifest.psd1` — the build collects all `#Requires` declarations automatically and writes them into the compiled manifest. Entries in `src/manifest.psd1` are silently ignored for this purpose. - **Group documentation pages with source.** Place a `.md` file alongside the function files in each `src/functions/public//` folder to provide a category overview in generated documentation. @@ -57,7 +58,6 @@ Layout rules: - No pipeline input. - No defaulting from context — public callers resolve before calling. - Required inputs declared as mandatory. -- No nested helper functions. If logic needs a helper, create it as a separate private function file under `src/functions/private//`. ## SOLID applied From c2f3add0d6077779768328f776ba9002ac53b916 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 19 Jul 2026 18:42:52 +0200 Subject: [PATCH 3/3] Clarify helper visibility decision Update the no-nested-functions rule to require explicitly deciding whether extracted functions are private internals or public API. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/docs/Modules/Standards.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/Modules/Standards.md b/src/docs/Modules/Standards.md index ca9cc16..0651cc5 100644 --- a/src/docs/Modules/Standards.md +++ b/src/docs/Modules/Standards.md @@ -42,7 +42,7 @@ Layout rules: - **One declaration per file.** Filename matches the declared symbol exactly, including casing. - **Group by domain.** Use resource or behaviour groups — not verb folders, not endpoint paths. - **Mirror public and private domains.** Public command under `src/functions/public/Projects/` has related private helpers under `src/functions/private/Projects/`. -- **No nested functions.** Do not define helper functions inside other functions. Put helper logic in separate private function files under `src/functions/private//`. +- **No nested functions.** Do not define helper functions inside other functions. Extract helper logic to a separate function file and decide whether it belongs in `src/functions/private//` (internal-only) or `src/functions/public//` (part of the module API). - **Declare dependencies where they are used.** Use `#Requires -Modules ` at the top of each function file that needs an external module. Do not add `RequiredModules` to `src/manifest.psd1` — the build collects all `#Requires` declarations automatically and writes them into the compiled manifest. Entries in `src/manifest.psd1` are silently ignored for this purpose. - **Group documentation pages with source.** Place a `.md` file alongside the function files in each `src/functions/public//` folder to provide a category overview in generated documentation.