dotnet / dotnet/format

🎉🥳 dotnet-format is now part of the .NET 6 SDK

Open
#1,268 14 comments 37 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

Starting with the .NET 6 Preview 7, which is [available now](https://dotnet.microsoft.com/download/dotnet/6.0), `dotnet format` is a built-in SDK command. As part of this move the options have changed a bit.

Invoking the SDKs `dotnet format` command will fix whitespace, code style, and analyzer issues by default.

There are also 3 subcommands to target specific scenarios:
- `dotnet format whitespace`: fixes whitespace
- `dotnet format style`: runs code style analyzers
- `dotnet format analyzers`: runs third party analyzers

### Common options for all commands
- `--no-restore`: Doesn't execute an implicit restore before formatting.
- `--include-generated`: Format files generated by the SDK
- `--include`: A list of relative file or folder paths to include in formatting. All files are formatted if empty.
- `--exclude`: A list of relative file or folder paths to exclude from formatting.
- `--verbosity`: Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]
- `--report`: Accepts a file path, which if provided, will produce a json report in the given directory.
- `--binarylog`: Log all project or solution load information to a binary log file.
- `--verify-no-changes`: Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted.

### Unique options for `dotnet format`

note, this is equivalent to `dotnet format --fix-whitespace --fix-style --fix-analyzers --diagnostics ` in the global tool today.

Note: if the user specifies a severity here it is used for both style and analyzers.

### Unique options for `dotnet format whitespace`

note, this is equivalent to `dotnet format --fix-whitespace` in the global tool today.

### Unique options for `dotnet format style`
- `--severity`: The severity of diagnostics to fix. Allowed values are info, warn, and error.

note, this is equivalent to `dotnet format --fix-style ` in the global tool today.

### Unique options for `dotnet cleanup analyzers`
- `--diagnostics`: A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues.
- `--severity`: The severity of diagnostics to fix. Allowed values are info, warn, and error.

note, this is equivalent to `dotnet format --fix-analyzers --diagnostics ` in the global tool today.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.