Commit cc8e543
authored
Adopt community PowerShell standards from PoshCode and the Microsoft style guide (#9)
## Summary
Adopts seven PowerShell and Markdown conventions our standards were
missing, found by comparing our Coding Standards against the community
references. The pages it edits were introduced by #1, now merged to
`main`; this branch has been rebased onto `main` so it applies cleanly.
**Sources analyzed:** PoshCode *PowerShell Practice and Style*; the
Microsoft PowerShell-Docs style guide; and dsccommunity.org (a Hugo
website with a git workflow that mirrors ours and no reusable coding
standards — nothing adopted from it).
## Changes
- **Tools vs. controllers, and raw output**
(`Coding-Standards/PowerShell/index.md`) — Closes #2
- **Output streams, and implicit output over `return`**
(`Coding-Standards/PowerShell/Functions.md`) — Closes #3
- **PowerShell error-handling idioms** — `-ErrorAction Stop`,
transaction-in-`try`, avoid `$?`, copy `$_` in `catch`
(`Coding-Standards/PowerShell/Functions.md`) — Closes #4
- **`[PSCredential]` parameters for secrets**
(`Coding-Standards/PowerShell/index.md`) — Closes #5
- **Full parameter names, no positional arguments, standard names**
(`Coding-Standards/PowerShell/index.md`) — Closes #6
- **Path handling** — avoid `~` and relative paths, use `$PSScriptRoot`,
the `[Environment]::CurrentDirectory` pitfall
(`Coding-Standards/PowerShell/Scripts.md`) — Closes #7
- **PowerShell code samples in docs** — `powershell` fence, `Output`
block, no backtick continuation (`Coding-Standards/Markdown.md`) —
Closes #8
## Validation
textlint (terminology), the documentation link checker, the index-drift
check, and the DNB-spillage scan all clean. Now that the base is `main`,
`Docs.yml` (lint, link validation, build) runs on this PR.1 parent 7a87e7e commit cc8e543
4 files changed
Lines changed: 40 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
70 | 84 | | |
71 | 85 | | |
72 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
22 | 31 | | |
23 | 32 | | |
24 | 33 | | |
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
28 | 37 | | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
49 | 59 | | |
50 | 60 | | |
51 | 61 | | |
52 | | - | |
| 62 | + | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
| |||
0 commit comments