GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Distinguish script-defined functions from DSC resources by Copilot · Pull Request #2297 · PowerShell/PSScriptAnalyzer

Conversation

Copilot AI commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

PR Summary

Follow-up to #2270, targeting its branch rather than main.

The review finding is reproducible: a resource-shaped call to a script-defined function is treated as a DSC declaration because command discovery uses a separate runspace. Commands inside its script block arguments are then incorrectly suppressed. Both new regression cases returned zero diagnostics before the fix instead of the two expected diagnostics.

  • Recognize function declarations in enclosing script-block scopes, case-insensitively, without searching unrelated nested scopes.
  • Use that information consistently for resource declarations and their same-line/following-line bodies. Do not apply implicit Get- prefix corrections to script-defined function calls; preserve explicit alias handling.
  • Cover script-level and configuration-level functions, both brace layouts, unrelated scopes, and formatter behavior. Document the distinction.

Validation: .NET 8 and .NET Framework 4.6.2 builds succeeded. Alias tests: 23 passed, 2 Windows-only tests skipped on Linux. Formatter integration tests: 10 passed. Executed using PowerShell 7.4.13 and Pester 5.7.1; the configured Pester 6.0.1 package was unavailable from the accessible mirror.

PR Checklist

  • PR has a meaningful title
  • Summarized changes
  • Change is not breaking
  • All changed source files have the correct copyright header
  • Added regression tests and updated documentation
  • This PR is ready to merge and is not Work in Progress (opened as a draft)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bergmeister
Distinguish script-defined functions from DSC resources
784620a
Resolve visible function declarations from the AST when classifying DSC resource syntax and checking implicit Get-prefix aliases. Preserve analysis of executable function arguments for both brace layouts.

Co-authored-by: Copilot <[email protected]>
Copilot AI assigned Copilot and Christoph Bergmeister (bergmeister) Oct 29, 2026
@bergmeister
Christoph Bergmeister (bergmeister) added this pull request to stack #2298 October 29, 2026 17:25
Copilot CLI created this pull request from a session on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 17:26
View session
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 29, 2026 18:35
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 18:35
View session
Copilot AI reviewed Oct 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Scoped function declarations are mishandled, causing incorrect alias rewrites and suppressed diagnostics, while repeated scope scans introduce quadratic analysis overhead.

2 open issues
  • Medium severity Handle scoped function declarations and visibility in analysis · New
  • Medium severity Index function declarations to avoid repeated AST traversal · New
What changed in this PR

This follow-up to #2270 distinguishes script-defined function calls from DSC resource declarations so alias analysis preserves function names while checking commands in their script-block arguments.

Changes:

  • Adds case-insensitive function lookup in enclosing script-block scopes and reuses it in DSC classification.
  • Adds regression coverage for function scope, brace layouts, unrelated scopes, and formatter behavior.
  • Documents the distinction between functions, DSC resources, and implicit aliases.
File Description
Tests/​Rules/​AvoidUsingAlias.tests.ps1 Adds function-detection and formatter regression tests.
Rules/​AvoidAlias.cs Uses script-defined function detection in alias and DSC handling.
docs/​Rules/​AvoidUsingCmdletAliases.md Explains function and DSC resource exclusions from implicit alias correction.

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Copilot started work on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 19:09
View session
@bergmeister
Index scoped functions in alias analysis
8f6c37e
Co-authored-by: bergmeister <[email protected]>
Copilot finished work on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 19:16
Copilot AI requested a review from Christoph Bergmeister (bergmeister) October 29, 2026 19:16
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 29, 2026 19:28
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 19:29
View session
Copilot AI reviewed Oct 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Scope handling still changes command resolution for dot-sourced private functions and incorrectly treats script/global declarations in unexecuted nested functions as visible, causing missed diagnostics and unsafe corrections.

2 open issues
  • Medium severity Handle dot-sourced blocks using caller scope · New
  • Medium severity Keep nested script/global declarations in lexical scope · New
2 resolved since last review
  • Medium severity Index function declarations to avoid repeated AST traversal
  • Medium severity Handle scoped function declarations and visibility in analysis

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Copilot started work on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 19:37
View session
@bergmeister
Fix scoped function visibility analysis
a6b0cd1
Co-authored-by: bergmeister <[email protected]>
Copilot finished work on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 19:45
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 29, 2026 20:21
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 20:22
View session
Copilot AI reviewed Oct 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Dot-sourced scope handling still misindexes declarations and incorrectly skips script-block argument scopes, causing both erroneous alias corrections and missed diagnostics.

2 open issues
  • Medium severity Avoid skipping scopes for script-block command arguments · New
  • Medium severity Index dot-sourced declarations in the effective caller scope · New
2 resolved since last review
  • Medium severity Keep nested script/global declarations in lexical scope
  • Medium severity Handle dot-sourced blocks using caller scope

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Copilot started work on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 20:32
View session
@bergmeister
Fix dot-sourced function scope indexing
d558096
Co-authored-by: bergmeister <[email protected]>
Copilot finished work on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 20:38
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 29, 2026 20:51
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 20:51
View session
Copilot AI reviewed Oct 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

The argument-count restriction incorrectly treats parameterized dot-sourced blocks as child scopes, causing erroneous alias formatting and missed declarations in the caller’s scope.

1 open issue
  • Medium severity Fix scope handling for parameterized dot-sourced blocks · New
2 resolved since last review
  • Medium severity Index dot-sourced declarations in the effective caller scope
  • Medium severity Avoid skipping scopes for script-block command arguments

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Copilot started work on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 21:07
View session
@bergmeister
Fix parameterized dot-source scope handling
82b986e
Co-authored-by: bergmeister <[email protected]>
Copilot finished work on behalf of Christoph Bergmeister (bergmeister) October 29, 2026 21:13
Copilot AI reviewed Nov 5, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved execution-order and scope-analysis errors cause valid function calls to be incorrectly rewritten as Get-Verb and required alias diagnostics to be suppressed.

4 open issues
  • Medium severity Resolve nested callback phases relative to their shared invocation · New
  • Medium severity Treat background pipeline blocks as isolated scopes · New
  • Medium severity Recognize native DSC script properties as isolated scopes · New
  • Medium severity Exclude declarations in statically unentered loop bodies · New

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Fix AvoidAlias scope review findings
5505906
Co-authored-by: bergmeister <[email protected]>
Copilot AI reviewed Nov 5, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Scope-boundary searches incorrectly isolate nested blocks in DSC callbacks and background pipelines, hiding enclosing local functions and causing erroneous alias rewrites.

2 open issues
  • Medium severity Preserve enclosing job functions in nested script blocks · New
  • Medium severity Limit DSC isolation to the property callback script block · New
4 resolved since last review
  • Medium severity Exclude declarations in statically unentered loop bodies
  • Medium severity Recognize native DSC script properties as isolated scopes
  • Medium severity Treat background pipeline blocks as isolated scopes
  • Medium severity Resolve nested callback phases relative to their shared invocation

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Fix nested scope boundaries in AvoidAlias
c326216
Co-authored-by: bergmeister <[email protected]>
Copilot AI reviewed Nov 5, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

The ancestor walk incorrectly treats a nested hashtable callback as an isolated DSC resource callback, causing a false Get-Verb suggestion; it needs to stop at an intervening ScriptBlockAst and gain regression coverage.

1 open issue
  • Medium severity Avoid treating nested ScriptBlock callbacks as DSC resource properties · New
2 resolved since last review
  • Medium severity Limit DSC isolation to the property callback script block
  • Medium severity Preserve enclosing job functions in nested script blocks

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Copilot AI and others added 2 commits November 5, 2026 18:28
@bergmeister
Add DSC nested callback regression
4cf0190
Co-authored-by: bergmeister <[email protected]>
@bergmeister
Skip DSC AST regression on Windows PowerShell
1d4d680
Co-authored-by: bergmeister <[email protected]>
Copilot AI reviewed Nov 5, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The scope traversal incorrectly promotes global: and script: function declarations from background jobs into the foreground scope, suppressing required diagnostics for implicit Get-Verb calls.

No open issues 🎉

1 resolved since last review
  • Medium severity Avoid treating nested ScriptBlock callbacks as DSC resource properties

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI reviewed Nov 6, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved scope-isolation and execution-order errors in AvoidAlias can suppress required diagnostics or incorrectly rewrite valid function calls.

4 open issues
  • Medium severity Handle for-loop body declarations before iterator calls · New
  • Medium severity Account for enclosing pipeline execution order · New
  • Medium severity Prevent background scopes from promoting function declarations · New
  • Medium severity Traverse scriptblock casts when checking job isolation · New

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Fix AvoidAlias scope and execution ordering
ca1b8e4
Co-authored-by: bergmeister <[email protected]>
Copilot AI reviewed Nov 6, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

The pipeline check incorrectly rejects function declarations that execute before later calls within the same pipeline element, causing valid calls such as Verb to be rewritten to Get-Verb.

1 open issue
  • Medium severity Preserve nested function declarations within the same pipeline element · New
4 resolved since last review
  • Medium severity Traverse scriptblock casts when checking job isolation
  • Medium severity Prevent background scopes from promoting function declarations
  • Medium severity Account for enclosing pipeline execution order
  • Medium severity Handle for-loop body declarations before iterator calls

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Fix AvoidAlias nested pipeline execution ordering
ce29d24
Co-authored-by: bergmeister <[email protected]>
Copilot AI reviewed Nov 6, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because subtle scope and execution-order interactions involving scriptblock casts, eager arguments, and background callbacks can cause incorrect alias resolution.

No open issues 🎉

1 resolved since last review
  • Medium severity Preserve nested function declarations within the same pipeline element

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI reviewed Nov 6, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unwrapping stops at [scriptblock] casts, causing incorrect scope and invocation classification that rewrites valid Verb calls to Get-Verb.

1 open issue
  • Medium severity Unwrap ScriptBlock casts during caller-scope analysis · New

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Unwrap ScriptBlock casts in caller scope analysis
5d150c1
Co-authored-by: bergmeister <[email protected]>
Copilot AI reviewed Nov 6, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Positional binding fails to exclude parameters supplied by name, causing incorrect execution-order analysis and an erroneous rewrite of Verb to Get-Verb in mixed named/positional commands.

No open issues 🎉

1 resolved since last review
  • Medium severity Unwrap ScriptBlock casts during caller-scope analysis

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI reviewed Nov 6, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved callback-binding and execution-flow errors produce incorrect alias diagnostics by misclassifying positional callbacks and indexing declarations from nonexecuting iterators or discarded script blocks.

2 open issues
  • Medium severity Do not treat script blocks discarded by void casts as callbacks · New
  • Medium severity Ignore for-loop iterator declarations when the condition is constant false · New

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Fix AvoidAlias callback scope edge cases
03be28b
Co-authored-by: bergmeister <[email protected]>
Copilot AI reviewed Nov 9, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Named-argument binding can cause incorrect alias rewrites, while oscillating scope resolution makes diagnostics depend on unrelated function declarations.

No open issues 🎉

2 resolved since last review
  • Medium severity Ignore for-loop iterator declarations when the condition is constant false
  • Medium severity Do not treat script blocks discarded by void casts as callbacks

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI reviewed Nov 9, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved execution-order and reachability errors in AvoidAlias cause valid function calls to be rewritten and required implicit-alias diagnostics to be suppressed.

6 open issues
  • Medium severity Track declarations across enclosing executing invocations · New
  • Medium severity Exclude eagerly evaluated arguments from callback exemptions · New
  • Medium severity Compare callbacks only with their directly containing pipeline · New
  • Medium severity Respect named-block order in isolated execution blocks · New
  • Medium severity Order dynamicparam before begin in phase mappings · New
  • Medium severity Account for unreachable elseif conditions · New

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Fix AvoidAlias scope ordering review findings
d16253b
Co-authored-by: bergmeister <[email protected]>

Copilot AI commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

🟡 Changes recommended...

Addressed all six review findings in d16253b. The targeted AvoidUsingAlias tests pass (140 passed).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot AI reviewed Nov 9, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

AvoidAlias misjudges function visibility across pipeline callbacks and eagerly evaluated arguments, causing incorrect alias rewrites and suppressed diagnostics.

2 open issues
  • Medium severity Distinguish deferred callback commands from eagerly resolved pipeline commands · New
  • Medium severity Inspect directly invoked blocks for eager argument evaluation · New
6 resolved since last review
  • Medium severity Account for unreachable elseif conditions
  • Medium severity Order dynamicparam before begin in phase mappings
  • Medium severity Respect named-block order in isolated execution blocks
  • Medium severity Compare callbacks only with their directly containing pipeline
  • Medium severity Exclude eagerly evaluated arguments from callback exemptions
  • Medium severity Track declarations across enclosing executing invocations

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Fix AvoidAlias pipeline callback ordering
b7583f9
Co-authored-by: bergmeister <[email protected]>
Copilot AI reviewed Nov 10, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Two critical pipeline callback-ordering errors can discard visible function declarations and cause the formatter to incorrectly replace script-defined Verb calls with Get-Verb.

2 open issues
  • High severity Preserve declarations across upstream End-to-downstream Process callbacks · New
  • High severity Infer effective phases for positional ForEach-Object script blocks · New
2 resolved since last review
  • Medium severity Inspect directly invoked blocks for eager argument evaluation
  • Medium severity Distinguish deferred callback commands from eagerly resolved pipeline commands

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Fix pipeline callback visibility ordering
36e9064
Co-authored-by: bergmeister <[email protected]>
Copilot AI reviewed Nov 11, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Phase inference misclassifies script-block arguments and omits wrapped or array-valued callbacks, which can suppress expected diagnostics or incorrectly rewrite valid function calls.

1 open issue
  • Medium severity Infer phases only from normalized Process callback arguments · New
2 resolved since last review
  • High severity Infer effective phases for positional ForEach-Object script blocks
  • High severity Preserve declarations across upstream End-to-downstream Process callbacks

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Fix ForEach-Object callback phase inference
7b766e1
Co-authored-by: bergmeister <[email protected]>
Copilot AI reviewed Nov 11, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because pipeline execution-order and background-job scoping interactions can cause incorrect function-visibility decisions and alias rewrites.

No open issues 🎉

1 resolved since last review
  • Medium severity Infer phases only from normalized Process callback arguments

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI reviewed Nov 11, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Function resolution still mishandles background runspaces, callback execution order, and discarded script blocks, suppressing required diagnostics or incorrectly rewriting real function calls.

3 open issues
  • Medium severity Detect background pipeline boundaries during function lookup · New
  • Medium severity Honor cross-command callback execution order before source offsets · New
  • Medium severity Exclude discarded pipeline expressions from function indexing · New

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Rules/AvoidAlias.cs
Comment on lines +397 to +399
if (IsIsolatedRunspaceScriptBlock(scope, functionAnalysis))
{
break;
Comment thread Rules/AvoidAlias.cs
&& !sharesInvocationScope
? functionScopeInvocation.Extent.StartOffset
: function.Extent.StartOffset;
return functionExecutionOffset > commandExecutionOffset;
Comment thread Rules/AvoidAlias.cs
Comment on lines +1779 to +1787
if (current.Parent is ParenExpressionAst
|| current.Parent is SubExpressionAst
|| current.Parent is CommandExpressionAst
|| current.Parent is PipelineAst
|| current.Parent is StatementBlockAst)
{
current = current.Parent;
continue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@bergmeister Christoph Bergmeister (bergmeister) Awaiting requested review from bergmeister bergmeister is a code owner
@michaeltlombardi Mikey Lombardi (He/Him) (michaeltlombardi) Awaiting requested review from michaeltlombardi michaeltlombardi will be requested when the pull request is marked ready for review michaeltlombardi is a code owner

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@bergmeister Christoph Bergmeister (bergmeister)

Copilot code review Copilot

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@bergmeister
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.