Skip to content

Minor changes to internal module commands code#27706

Open
guillermooo wants to merge 18 commits into
PowerShell:masterfrom
guillermooo:users/guillermo/refactor/minor
Open

Minor changes to internal module commands code#27706
guillermooo wants to merge 18 commits into
PowerShell:masterfrom
guillermooo:users/guillermo/refactor/minor

Conversation

@guillermooo

@guillermooo guillermooo commented Jul 20, 2026

Copy link
Copy Markdown

PR Summary

A few relatively minor refactors.

PR Context

I'm getting familiar with the PowerShell code base and I found a few rough spots. I'm not sure whether this kind of spontaneous changes are welcome, though.

I haven't run any tests, mainly because I figured out how to build, but not yet how to run the test suite.

PR Checklist

No call sites using parameter name.
No call sites using parameter name. Same parameter name as
`System.IO.Path.GetRelativePath()`.
The argument for `moduleNameOrPath` cannot be null at the current call
sites.
The point is to return a fully qualified path, which cannot be the case
if `relativeTo` is `null` and we need to use it.
Relatively short signature and no more than three parameters.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@guillermooo
guillermooo marked this pull request as ready for review July 20, 2026 22:39
@guillermooo
guillermooo requested a review from a team as a code owner July 20, 2026 22:39
Copilot AI review requested due to automatic review settings July 20, 2026 22:39
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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.

Pull request overview

This PR makes small refactors in internal module-specification handling, focusing on string comparisons, module-name normalization, and clearer documentation around module specification behavior.

Changes:

  • Use EqualsOrdinalIgnoreCase(...) for module specification hashtable key comparisons and explicitly discard the GetMaximumVersion(...) return value.
  • Refine ModuleSpecificationComparer equality semantics and documentation (including reference equality fast-path).
  • Refactor and re-document ModuleIntrinsics.NormalizeModuleName(...) with updated parameter naming and argument validation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/System.Management.Automation/engine/Modules/ModuleSpecification.cs Refactors module-spec initialization comparisons and updates the structural equality comparer logic.
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs Refactors and expands docs for module-name normalization and updates null-handling behavior.

Comment thread src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
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.

2 participants