You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/instructions/dsc-community-style-guidelines-powershell.instructions.md
+22-7Lines changed: 22 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,8 +64,8 @@ applyTo: "**/*.ps?(m|d)1"
64
64
- Comment-based help: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, EXAMPLE sections before function/class
65
65
- Comment-based help indentation: keywords 4 spaces, text 8 spaces
66
66
- Include examples for all parameter sets and combinations
67
-
- INPUTS: List each pipeline‑accepted type (one per line) with a 1‑line description.
68
-
- OUTPUTS: List each return type (one per line) with a 1‑line description. Must match both [OutputType()] and actual returns.
67
+
- INPUTS: List each pipeline‑accepted type (one per line) with a 1‑line description. Repeat keyword for each input type.
68
+
- OUTPUTS: List each return type (one per line) with a 1‑line description. Repeat keyword for each output type. Must match both `[OutputType()]` and actual returns.
69
69
- .NOTES: Include only if it conveys critical info (constraints, side effects, security, version compatibility, breaking behavior). Keep to ≤2 short sentences.
70
70
71
71
## Functions
@@ -83,6 +83,7 @@ applyTo: "**/*.ps?(m|d)1"
83
83
- Inside `$PSCmdlet.ShouldProcess`-block, avoid using `Write-Verbose`
84
84
- Never use backtick as line continuation in production code.
85
85
- Set `$ErrorActionPreference = 'Stop'` before commands using `-ErrorAction 'Stop'`; restore previous value directly after invocation (do not use try-catch-finally)
86
+
- Use `[Alias()]` attribute for function aliases, never `Set-Alias` or `New-Alias`
86
87
87
88
## Output streams
88
89
@@ -92,7 +93,10 @@ applyTo: "**/*.ps?(m|d)1"
92
93
- Use `Write-Information` for: User-facing status updates; Important operational messages; Non-error state changes
93
94
- Use `Write-Warning` for: Non-fatal issues requiring attention; Deprecated functionality usage; Configuration problems that don't block execution
94
95
- Use `$PSCmdlet.ThrowTerminatingError()` for terminating errors (except for classes), use relevant error category, in try-catch include exception with localized message
95
-
- Use `Write-Error` for non-terminating errors, use relevant error category; always use `return` after `Write-Error` to avoid further processing
Tests if the SQL Agent Alert named 'MyAlert' exists and has message ID 50001.
57
+
Tests if the SQL Agent Alert has severity level 16 using alert object pipeline input.
48
58
#>
49
-
functionTest-SqlDscAgentAlert
59
+
functionTest-SqlDscAgentAlertProperty
50
60
{
51
61
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('UseSyntacticallyCorrectExamples','', Justification ='Because the rule does not yet support parsing the code when a parameter type is not available. The ScriptAnalyzer rule UseSyntacticallyCorrectExamples will always error in the editor due to https://github.com/indented-automation/Indented.ScriptAnalyzerRules/issues/8.')]
0 commit comments