Skip to content

Preserve nested DSC resources in same-line Node blocks - #2282

Merged
Christoph Bergmeister (bergmeister) merged 2 commits into
copilot/fix-auto-correct-aliasesfrom
copilot/fix-comments-in-review-thread
Oct 28, 2026
Merged

Christoph Bergmeister (bergmeister) merged 2 commits into
copilot/fix-auto-correct-aliasesfrom
copilot/fix-comments-in-review-thread

Conversation

Copilot AI commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

When node is discoverable, command lookup can misclassify a same-line DSC Node container as executable code and apply Get- corrections to nested resources.

  • Detection: Skip command lookup for resource-shaped Node containers.
  • Regression coverage: Check that nested resource declarations remain unchanged:
Node localhost { Package PackageExample {} }

Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code based on comments from review thread Preserve nested DSC resources in same-line Node blocks Oct 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the change addressing alias-rule misclassification of nested DSC resources.

No open issues 🎉

What changed in this PR

This PR prevents the alias rule from misclassifying nested DSC resources when a same-line Node container shares its name with a discoverable executable.

Changes:

  • Bypasses command lookup for resource-shaped Node containers.
  • Adds a regression test verifying that nested resource declarations produce no alias diagnostics when node is discoverable.
File Description
Tests/​Rules/​AvoidUsingAlias.tests.ps1 Tests a same-line Node declaration containing a nested Package resource.
Rules/​AvoidAlias.cs Exempts Node containers from the enclosing-command lookup check.

Review effort: Balanced

@bergmeister
Christoph Bergmeister (bergmeister) marked this pull request as ready for review October 28, 2026 16:20
@bergmeister
Christoph Bergmeister (bergmeister) merged commit ab700bf into copilot/fix-auto-correct-aliases Oct 28, 2026
8 of 11 checks passed
@bergmeister
Christoph Bergmeister (bergmeister) deleted the copilot/fix-comments-in-review-thread branch October 28, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants