-
Notifications
You must be signed in to change notification settings - Fork 171
Description
Starting with the .NET 6 Preview 7, which is available now, 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 whitespacedotnet format style: runs code style analyzersdotnet 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 <project or solution> --fix-whitespace --fix-style <severity> --fix-analyzers <severity> --diagnostics <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 <project or solution> --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 <project or solution> --fix-style <severity> 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 <project or solution> --fix-analyzers <severity> --diagnostics <diagnostics> in the global tool today.