Repository navigation
Preserve alias diagnostics for two-element DSC-shaped commands - #2295
Merged
Christoph Bergmeister (bergmeister) merged 3 commits intoOct 29, 2026
Conversation
Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix the code for review comments in pull request 2270
Preserve alias diagnostics for two-element DSC-shaped commands
Oct 29, 2026
Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the change that makes alias diagnostics consistent across brace placement.
No open issues 🎉
What changed in this PR
This PR makes alias diagnostics consistent across brace placement by preserving warnings for two-element commands that resemble DSC resource declarations.
Changes:
- Remove the two-element exception when the command name resolves to an alias.
- Update regression assertions to expect the
gcidiagnostic and itsGet-ChildItemcorrection, with consistent counts across PowerShell versions.
| File | Description |
|---|---|
| Tests/Rules/AvoidUsingAlias.tests.ps1 | Update diagnostic counts and verify the gci correction. |
| Rules/AvoidAlias.cs | Preserve diagnostics for explicit aliases in DSC-shaped commands. |
Review effort: Balanced
Christoph Bergmeister (bergmeister)
marked this pull request as ready for review
October 29, 2026 14:53
Christoph Bergmeister (bergmeister)
requested a review
from a team
as a code owner
October 29, 2026 14:53
Christoph Bergmeister (bergmeister)
removed this pull request from stack #2296
October 29, 2026 14:53
Christoph Bergmeister (bergmeister)
merged commit Oct 29, 2026
9914f20
into
copilot/fix-auto-correct-aliases
8 checks passed
Christoph Bergmeister (bergmeister)
deleted the
copilot/fix-code-for-review-comments
branch
October 29, 2026 14:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A two-element command followed by a next-line block could be mistaken for a DSC resource declaration, suppressing its alias diagnostic. This made the
gcicorrection depend on brace placement.Get-ChildItem.gci ResourceAliasExample { Name = "Example" }