Skip to content

Code Formatter: Don't remove module names from cmdlet calls #2123

Description

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.

Summary

Currently, with the code formatter, if you have a cmdlet call such as MicrosoftTeams\Get-CsLisCivicAddress, and run the formatter, it will remove the module name resulting in Get-CsLisCivicAddress. Including the module name gives specificity with clobbered cmdlets, as in my case. Get-CsLisCivicAddress is a valid function in two different modules.

As I understand it, including the module name in functions/modules is actually a best practice.

I've been through all the code formatting settings and none seem to relate to the above experience, including 'Auto Correct Aliases'. Disabling this did not change the behavior.

Proposed Design

At a minimum, I would like an option to enable/disable this, perhaps "Auto Remove Module Name from Cmdlets".

Even better would be expanding this to automatically add the module name to cmdlets when possible. So writing Get-CsLisCivicAddress would be converted to MicrosoftTeams\Get-CsLisCivicAddress. The option could be a drop down with Remove/Do Nothing/Add.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions