Skip to content

Commit 1baefd0

Browse files
authored
Merge branch 'main' into copilot/fix-2e4f4524-bcfc-418f-abb1-7eb2a7482232
2 parents 72a112e + 8313dbe commit 1baefd0

89 files changed

Lines changed: 4718 additions & 268 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,2 @@
1-
# AI Instructions
2-
3-
This file provides AI agent guidance for the project. Each instruction file below
4-
targets specific file glob patterns and use cases.
5-
6-
## Build & Test Workflow
7-
- Run in PowerShell, from repository root
8-
- Build before running tests: `.\build.ps1 -Tasks build`
9-
- Always run tests in new PowerShell session: `Invoke-Pester -Path @({test paths}) -Output Detailed`
10-
11-
## Instructions Overview
12-
13-
The guidelines always take priority over existing code patterns in project.
14-
1+
# Requirements
152
- SqlServerDsc-specific guidelines override general project guidelines
16-
- Follow PowerShell style guidelines
17-
- Maintain localization requirements across all source files
18-
- Follow test patterns strictly for maintainability
19-
20-
## Core Project Guidelines
21-
22-
- Follow SqlServerDsc project specific guidelines: [./instructions/SqlServerDsc-guidelines.instructions.md](./instructions/SqlServerDsc-guidelines.instructions.md)
23-
- Always follow PowerShell code style guidelines: [./instructions/dsc-community-style-guidelines-powershell.instructions.md](./instructions/dsc-community-style-guidelines-powershell.instructions.md)
24-
- Follow Project-level guidelines: [./instructions/dsc-community-style-guidelines.instructions.md](./instructions/dsc-community-style-guidelines.instructions.md)
25-
- Follow localization requirements: [./instructions/dsc-community-style-guidelines-localization.instructions.md](./instructions/dsc-community-style-guidelines-localization.instructions.md)
26-
- Always add Unit testing according to: [./instructions/dsc-community-style-guidelines-unit-tests.instructions.md](./instructions/dsc-community-style-guidelines-unit-tests.instructions.md)
27-
- Always add Integration testing according to: [./instructions/dsc-community-style-guidelines-integration-tests.instructions.md](./instructions/dsc-community-style-guidelines-integration-tests.instructions.md)
28-
- Follow Markdown formatting requirements: [./instructions/dsc-community-style-guidelines-markdown.instructions.md](./instructions/dsc-community-style-guidelines-markdown.instructions.md)
29-
- Always update CHANGELOG.md: [./instructions/dsc-community-style-guidelines-changelog.instructions.md](./instructions/dsc-community-style-guidelines-changelog.instructions.md)
30-
31-
## Desired State Configuration (DSC) Resource Guidelines
32-
33-
New DSC resources should always be created as class-based resources.
34-
35-
- Follow class-based resources guidelines: [./instructions/dsc-community-style-guidelines-class-resource.instructions.md](./instructions/dsc-community-style-guidelines-class-resource.instructions.md)

.github/instructions/dsc-community-style-guidelines-class-resource.instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ Add to .DESCRIPTION section:
8686
- `## Requirements`: List minimum requirements
8787
- `## Known issues`: Critical issues + pattern: `All issues are not listed here, see [all open issues](https://github.com/{owner}/{repo}/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+{ResourceName}).`
8888

89-
## Error Handling
89+
## Error Handling for classes
9090
- Use `try/catch` blocks to handle exceptions
91-
- Do not use `throw` for terminating errors, use `New-*Exception` commands:
91+
- Do not use `throw` for terminating errors, use `New-*Exception` commands (never for functions):
9292
- [`New‑InvalidDataException`](https://github.com/dsccommunity/DscResource.Common/wiki/New%E2%80%91InvalidDataException)
9393
- [`New-ArgumentException`](https://github.com/dsccommunity/DscResource.Common/wiki/New%E2%80%91ArgumentException)
9494
- [`New-InvalidOperationException`](https://github.com/dsccommunity/DscResource.Common/wiki/New%E2%80%91InvalidOperationException)

.github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ applyTo: "source/DSCResources/**/*.psm1"
2828
- Use localized strings for all messages (Write-Verbose, Write-Error, etc.)
2929
- Import localized strings using `Get-LocalizedData` at module top
3030

31-
## Error Handling
32-
- Do not use `throw` for terminating errors
31+
## Error Handling for MOF-based resources
3332
- Use `try/catch` blocks to handle exceptions
34-
- Throw localized exceptions using the appropriate `New-*Exception` cmdlet:
33+
- Do not use `throw` for terminating errors, use `New-*Exception` commands (never for functions):
3534
- [`New‑InvalidDataException`](https://github.com/dsccommunity/DscResource.Common/wiki/New%E2%80%91InvalidDataException)
3635
- [`New-ArgumentException`](https://github.com/dsccommunity/DscResource.Common/wiki/New%E2%80%91ArgumentException)
3736
- [`New-InvalidOperationException`](https://github.com/dsccommunity/DscResource.Common/wiki/New%E2%80%91InvalidOperationException)

.github/instructions/dsc-community-style-guidelines-pester.instructions.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ applyTo: "**/*.[Tt]ests.ps1"
1414
- Never test verbose messages, debug messages or parameter binding behavior
1515
- Pass all mandatory parameters to avoid prompts
1616

17+
## Requirements
18+
- Inside `It` blocks, assign unused return objects to `$null` (unless part of pipeline)
19+
- Tested entity must be called from within the `It` blocks
20+
- Keep results and assertions in same `It` block
21+
- Avoid try-catch-finally for cleanup, use `AfterAll` or `AfterEach`
22+
- Avoid unnecessary remove/recreate cycles
23+
1724
## Naming
1825
- One `Describe` block per file matching the tested entity name
1926
- `Context` descriptions start with 'When'
@@ -51,10 +58,6 @@ applyTo: "**/*.[Tt]ests.ps1"
5158
- Keep scope close to usage context
5259

5360
## Best Practices
54-
- Inside `It` blocks, assign unused return objects to `$null` (unless part of pipeline)
55-
- Tested entity must be called from within the `It` blocks
56-
- Keep results and assertions in same `It` block
5761
- Cover all scenarios and code paths
5862
- Use `BeforeEach` and `AfterEach` sparingly
59-
- Avoid try-catch-finally for cleanup, use `AfterAll` or `AfterEach`
60-
- Avoid unnecessary remove/recreate cycles
63+
- Use `$PSDefaultParameterValues` only for Pester commands (`Describe`, `Context`, `It`, `Mock`, `Should`, `InModuleScope`)

.github/instructions/dsc-community-style-guidelines-powershell.instructions.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ applyTo: "**/*.ps?(m|d)1"
7979
- For state-changing functions, use `SupportsShouldProcess`
8080
- Place ShouldProcess check immediately before each state-change
8181
- `$PSCmdlet.ShouldProcess` must use required pattern
82+
- Inside `$PSCmdlet.ShouldProcess`-block, avoid using `Write-Verbose`
8283
- Never use backtick as line continuation in production code.
84+
- Set `$ErrorActionPreference = 'Stop'` before commands using `-ErrorAction 'Stop'`; restore after
8385

8486
## Output streams
8587

@@ -88,7 +90,7 @@ applyTo: "**/*.ps?(m|d)1"
8890
- Use `Write-Verbose` for: High-level execution flow only; User-actionable information
8991
- Use `Write-Information` for: User-facing status updates; Important operational messages; Non-error state changes
9092
- Use `Write-Warning` for: Non-fatal issues requiring attention; Deprecated functionality usage; Configuration problems that don't block execution
91-
- Use `$PSCmdlet.ThrowTerminatingError()` for terminating errors (except for classes), use relevant error category
93+
- Use `$PSCmdlet.ThrowTerminatingError()` for terminating errors (except for classes), use relevant error category, in try-catch include exception
9294
- Use `Write-Error` for non-terminating errors, use relevant error category
9395

9496
## ShouldProcess Required Pattern
@@ -181,6 +183,7 @@ function Get-Something
181183
- Limit piping to one pipe per line
182184
- Assign function results to variables rather than inline calls
183185
- Return a single, consistent object type per function
186+
- return `$null` for no objects/non-terminating errors
184187

185188
### Security & Safety
186189

.github/instructions/dsc-community-style-guidelines.instructions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ applyTo: "**"
2222
- Integration tests: `tests/Integration/Commands/{CommandName}.Integration.Tests.ps1`
2323

2424
## Requirements
25-
- Follow guidelines over existing code patterns
25+
- Follow instructions over existing code patterns
26+
- Follow PowerShell style and test guideline instructions strictly
2627
- Always update CHANGELOG.md Unreleased section
2728
- Localize all strings using string keys; remove any orphaned string keys
2829
- Check DscResource.Common before creating private functions
2930
- Separate reusable logic into private functions
31+
- DSC resources should always be created as class-based resources
3032
- Add unit tests for all commands/functions/resources
3133
- Add integration tests for all public commands and resources

.github/workflows/code-analysis-built-module.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
shell: powershell
2626
run: |
2727
dotnet tool install --global GitVersion.Tool --version 5.*
28-
dotnet-gitversion
2928
- name: Run GitVersion
3029
shell: powershell
3130
run: |

.github/workflows/code-analysis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
shell: powershell
2626
run: |
2727
dotnet tool install --global GitVersion.Tool --version 5.*
28-
dotnet-gitversion
2928
- name: Run GitVersion
3029
shell: powershell
3130
run: |

.github/workflows/copilot-setup-steps.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ jobs:
205205
- name: Verify GitVersion
206206
shell: pwsh
207207
run: |
208-
Write-Host 'Running GitVersion to determine semantic version...'
209-
dotnet-gitversion
210208
Write-Host 'Running GitVersion to determine semantic version (parsing to PowerShell object)...'
211209
dotnet-gitversion | ConvertFrom-Json
212210

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090
"SOURCEBRANCH",
9191
"SOURCEBRANCHNAME",
9292
"setvariable",
93-
"RAISERROR"
93+
"RAISERROR",
94+
"filegroup"
9495
],
9596
"cSpell.ignorePaths": [
9697
".git"

0 commit comments

Comments
 (0)