Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up extensions for dotnet CLI & Utils #47373

Merged
merged 7 commits into from
Mar 10, 2025
Merged

Conversation

MiYanni
Copy link
Member

@MiYanni MiYanni commented Mar 8, 2025

Summary

Simple PR. Does exactly these things for the dotnet and Microsoft.DotNet.Cli.Utils projects:

  • Moved project root-level Extensions classes into an Extensions folder.
    • Utils had this folder already with some classes. dotnet did not.
  • Normalized the namespaces for all Extensions classes.
  • Renamed CommonOptionsExtension to CommonOptionsExtensions to match the naming style convention.

@MiYanni MiYanni requested review from a team and Copilot March 8, 2025 01:13
@MiYanni MiYanni requested review from a team, sharwell and arunchndr as code owners March 8, 2025 01:14
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Mar 8, 2025
var lastMatchingItemGroup = FindExistingUniformItemGroupWithCondition(root, projectItemElementType, framework);
var lastMatchingItemGroup = root.FindExistingUniformItemGroupWithCondition(projectItemElementType, framework);
Copy link
Member Author

Choose a reason for hiding this comment

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

VS IDE did this automatically.

Choose a reason for hiding this comment

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

PR Overview

This PR cleans up and normalizes the Extensions classes for the dotnet CLI and related projects by moving them into a dedicated Extensions folder and updating the relevant namespaces.

  • Moved Extensions classes to an Extensions folder in the dotnet CLI project.
  • Normalized namespaces across the Extensions classes and updated using directives in consuming files.
  • Renamed CommonOptionsExtension to CommonOptionsExtensions to align with naming conventions.

Reviewed Changes

File Description
src/Cli/Microsoft.DotNet.Cli.Utils/Extensions/CollectionsExtensions.cs Updated namespace to Microsoft.DotNet.Cli.Utils.Extensions.
src/Cli/Microsoft.DotNet.Cli.Utils/Extensions/LockFileExtensions.cs Changed namespace and updated class access modifier to internal.
src/Cli/Microsoft.DotNet.Cli.Utils/Extensions/ExceptionExtensions.cs Updated namespace to Microsoft.DotNet.Cli.Utils.Extensions.
src/Cli/Microsoft.DotNet.Cli.Utils/Extensions/ProcessStartInfoExtensions.cs Updated namespace to Microsoft.DotNet.Cli.Utils.Extensions.
src/Cli/Microsoft.DotNet.Cli.Utils/Extensions/AnsiExtensions.cs Updated namespace to Microsoft.DotNet.Cli.Utils.Extensions.
src/Cli/Microsoft.DotNet.Cli.Utils/Extensions/MSBuildProjectExtensions.cs Updated namespace and modified an extension method call for clarity.
src/Cli/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs Added using directive for the updated Extensions namespace.
src/Cli/Microsoft.DotNet.Cli.Utils/Extensions/LockFileFormatExtensions.cs Updated namespace to Microsoft.DotNet.Cli.Utils.Extensions.
src/Cli/Microsoft.DotNet.Cli.Utils/GracefulException.cs Added using directive for the updated Extensions namespace.
src/Cli/Microsoft.DotNet.Cli.Utils/EnvironmentProvider.cs Added using directive for the updated Extensions namespace.
src/Cli/Microsoft.DotNet.Cli.Utils/Command.cs Added using directive for the updated Extensions namespace.
src/Cli/Microsoft.DotNet.Cli.Utils/Extensions/ProcessExtensions.cs Updated namespace to Microsoft.DotNet.Cli.Utils.Extensions.
src/Cli/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs Updated using directive to the new Extensions namespace.
src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs Added using directive for the updated Extensions namespace.
src/BuiltInTools/dotnet-watch/CommandLineOptions.cs Updated using directive to reference Microsoft.DotNet.Cli.Extensions.
src/Cli/Microsoft.TemplateEngine.Cli/PostActionProcessors/InstructionDisplayPostActionProcessor.cs Added using directive for the updated Extensions namespace.
src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.NoMatchHandling.cs Added using directive for the updated Extensions namespace.
src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.cs Added using directive for the updated Extensions namespace.
src/Cli/Microsoft.TemplateEngine.Cli/PostActionDispatcher.cs Added using directive for the updated Extensions namespace.
src/Cli/Microsoft.TemplateEngine.Cli/Commands/BaseCommand.cs Added using directive for the updated Extensions namespace.

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

return option.SetForwardingFunction((string o) =>
return option.SetForwardingFunction((o) =>
Copy link
Member Author

Choose a reason for hiding this comment

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

Also automatic by VS IDE.

Copy link
Member

@Forgind Forgind left a comment

Choose a reason for hiding this comment

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

I mentioned offline the one pattern change that I don't like and would prefer reverting, but beyond that, this looks good 👍

MiYanni added 2 commits March 10, 2025 13:11
# Conflicts:
#	src/Cli/dotnet/Extensions/OptionForwardingExtensions.cs
@MiYanni MiYanni enabled auto-merge March 10, 2025 20:14
@MiYanni MiYanni merged commit 8166b99 into dotnet:main Mar 10, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CLI untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants