From 58e5d473b3182615245b7082e3df6c520655696e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Oct 2026 13:15:09 +0000 Subject: [PATCH 1/3] Initial plan From d6ca8f2a4742b4bd8951b47fdba0bd6a0f67c0e3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Oct 2026 13:18:56 +0000 Subject: [PATCH 2/3] Fix AvoidAlias DSC regression Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com> --- Rules/AvoidAlias.cs | 3 +-- Tests/Rules/AvoidUsingAlias.tests.ps1 | 12 +++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Rules/AvoidAlias.cs b/Rules/AvoidAlias.cs index d1ab8b780..c6435833d 100644 --- a/Rules/AvoidAlias.cs +++ b/Rules/AvoidAlias.cs @@ -120,8 +120,7 @@ public IEnumerable AnalyzeScript(Ast ast, string fileName) string cmdletNameIfCommandNameWasAlias = Helper.Instance.GetCmdletNameFromAlias(commandName); bool isDscResourceDeclaration = IsDscResourceDeclaration(cmdAst); - if (isDscResourceDeclaration - && (String.IsNullOrEmpty(cmdletNameIfCommandNameWasAlias) || cmdAst.CommandElements.Count == 2)) + if (isDscResourceDeclaration && String.IsNullOrEmpty(cmdletNameIfCommandNameWasAlias)) { continue; } diff --git a/Tests/Rules/AvoidUsingAlias.tests.ps1 b/Tests/Rules/AvoidUsingAlias.tests.ps1 index 60b4c7a6f..6b15c934c 100644 --- a/Tests/Rules/AvoidUsingAlias.tests.ps1 +++ b/Tests/Rules/AvoidUsingAlias.tests.ps1 @@ -153,14 +153,16 @@ Configuration PackageTest { $violations = @($rule.AnalyzeScript($configuration, $null)) - $violations.Count | Should -Be 7 - $violations[0].Extent.Text | Should -Be 'icm' - $violations[1].Extent.Text | Should -Be 'Verb' + $violations.Count | Should -Be 8 + $violations[0].Extent.Text | Should -Be 'gci' + $violations[0].SuggestedCorrections[0].Text | Should -Be 'Get-ChildItem' + $violations[1].Extent.Text | Should -Be 'icm' $violations[2].Extent.Text | Should -Be 'Verb' $violations[3].Extent.Text | Should -Be 'Verb' - $violations[4].Extent.Text | Should -Be 'icm' - $violations[5].Extent.Text | Should -Be 'Verb' + $violations[4].Extent.Text | Should -Be 'Verb' + $violations[5].Extent.Text | Should -Be 'icm' $violations[6].Extent.Text | Should -Be 'Verb' + $violations[7].Extent.Text | Should -Be 'Verb' } It "does not ignore executable commands in assignment and expression contexts or pipelines" { From 93cf06b52c9fb7ef23553146032afb0b291d6e14 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Oct 2026 14:03:23 +0000 Subject: [PATCH 3/3] Fix Windows Pester expected alias count Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com> --- Tests/Rules/AvoidUsingAlias.tests.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tests/Rules/AvoidUsingAlias.tests.ps1 b/Tests/Rules/AvoidUsingAlias.tests.ps1 index 6b15c934c..814574525 100644 --- a/Tests/Rules/AvoidUsingAlias.tests.ps1 +++ b/Tests/Rules/AvoidUsingAlias.tests.ps1 @@ -281,8 +281,7 @@ Configuration PackageTest { $violations = @($rule.AnalyzeScript($configuration, $null)) - $expectedViolations = if ($PSVersionTable.PSVersion.Major -ge 7) { 4 } else { 3 } - $violations.Count | Should -Be $expectedViolations + $violations.Count | Should -Be 4 $violations | ForEach-Object { $_.Extent.Text | Should -Be 'gci' $_.SuggestedCorrections[0].Text | Should -Be 'Get-ChildItem'