Skip to content

📖 [Docs]: Coding standards put reuse before building (and .NET when you build)#18

Open
Marius Storhaug (MariusStorhaug) wants to merge 8 commits into
mainfrom
docs/powershell-prefer-dotnet
Open

📖 [Docs]: Coding standards put reuse before building (and .NET when you build)#18
Marius Storhaug (MariusStorhaug) wants to merge 8 commits into
mainfrom
docs/powershell-prefer-dotnet

Conversation

@MariusStorhaug

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented Jul 5, 2026

Copy link
Copy Markdown
Member

The coding standards now make the reuse decision explicit: before writing new logic, reach for what already exists — a language or runtime built-in, then an existing function, then a trusted dependency — and build it yourself only when nothing fits. The PowerShell idiom's ".NET" guidance is reframed to fit that order: .NET is what you reach for when you implement the work (or fix a slow internal function), not the first resort ahead of reusing a cmdlet or an existing function.

⚠️ This PR has no linked issue. Consider creating one for traceability.

Changed: reuse comes before building

src/docs/Coding-Standards/Functions.md gains a Reuse before you build section (language-agnostic — DRY and single responsibility applied across the whole codebase):

  • Prefer a built-in.
  • Reuse an existing function; if it is the weak link on a hot path, fix it there so every caller benefits.
  • Take a dependency on a trusted module for a larger capability that already exists.
  • Build it only when nothing fits — sized to the need (small logic inline, a larger capability as its own module).

Changed: PowerShell — reuse first, then reach for .NET

The "do the work in .NET" idiom in src/docs/Coding-Standards/PowerShell/index.md now leads with the reuse order (built-in cmdlet/operator → module function → #Requires / RequiredModules dependency → your own code) and links the baseline. The .NET specifics (hot-path calls, [void] / $null =, typed lists) remain for when you actually implement the work.

Technical Details

@MariusStorhaug Marius Storhaug (MariusStorhaug) added the documentation Improvements or additions to documentation label Jul 5, 2026
@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title PR description being generated... 📖 [Docs]: PowerShell standard now prefers .NET for the actual work Jul 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the PowerShell coding standard to add an explicit, general “do the work in .NET” guideline, giving contributors a single, citable rule-of-thumb for choosing .NET APIs over cmdlet/pipeline usage on hot paths or where precision matters.

Changes:

  • Adds a new “Do the work in .NET; use cmdlets to orchestrate it” bullet under Idioms and pitfalls.
  • Frames the next two existing performance tips (avoid Out-Null, avoid += in loops) as specific applications of the new principle.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MariusStorhaug Marius Storhaug (MariusStorhaug) marked this pull request as ready for review July 5, 2026 23:32
@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title 📖 [Docs]: PowerShell standard now prefers .NET for the actual work 📖 [Docs]: Coding standards put reuse before building (and .NET when you build) Jul 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/docs/Coding-Standards/PowerShell/index.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/docs/Coding-Standards/Functions.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/docs/Coding-Standards/Functions.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants