Skip to content

dotnet format support for excluding specific subcommands with --skip in dotnet format #48871

Open
@michha

Description

@michha

Disclaimer: this is a sort of repost from an issue of the old dotnet format repo that I found when searching for an existing issue of my problem. Kudos to @MohammadAminPourmoradian .

Description:

The dotnet format command currently supports three subcommands: whitespace, style, and analyzers. However, there is no option to exclude a specific subcommand while running the rest in a single command. This limitation forces users to run multiple commands to achieve desired formatting.

Proposed Improvement:

Introduce a new switch, --skip, to allow excluding specific subcommands while applying the rest in a single dotnet format command. For example:

dotnet format --skip analyzers 

which does the same as dotnet format whitespace and dotnet format style but within a single command.

Benefits:

Simplified Workflow: Allows users to exclude a specific subcommand while running the remaining subcommands in one go.
Time-Saving: Reduces the number of commands needed to achieve desired formatting, saving time and effort.
Enhanced Control: Provides users with more flexibility over the formatting process, tailoring it to their specific needs.

Sample Scenario:

Our central build template includes dotnet format as well as dotnet build. Recently we discovered that the analyzer part of dotnet format needs most of the command time (e.g. whitespace needs 20 seconds, style needs 40 seconds, analyzers needs 200 seconds). Because the analyzers will run again in the after coming dotnet build, it would be nice to skip them (in a single command).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions