dotnet / dotnet/format

--verbosity does not accept capitalized values

Open
#1,797 4 comments 0 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

I'm using [Nuke](https://nuke.build/) to implement various pipelines.

I added dotnet format (see https://github.com/nuke-build/nuke/pull/1032), which is already released with the latest version.

Nuke handle verbosity for `dotnet` with the enum `DotNetVerbosity`.
```csharp
public partial class DotNetVerbosity : Enumeration
{
public static DotNetVerbosity Quiet = (DotNetVerbosity) "Quiet";
public static DotNetVerbosity Minimal = (DotNetVerbosity) "Minimal";
public static DotNetVerbosity Normal = (DotNetVerbosity) "Normal";
public static DotNetVerbosity Detailed = (DotNetVerbosity) "Detailed";
public static DotNetVerbosity Diagnostic = (DotNetVerbosity) "Diagnostic";
public static implicit operator DotNetVerbosity(string value)
{
return new DotNetVerbosity { Value = value };
}
}
```

This enum is now also used for dotnet format. All dotnet commands which I use (`clean`, `restore`, `compile`, `pack`) can handle verbosity with capitalized value except `format`.

Console Output:
```
C:\projects\format_test>dotnet clean FormatTest.sln --verbosity Quiet
MSBuild version 17.4.0+18d5aef85 for .NET

C:\projects\format_test>dotnet restore FormatTest.sln --verbosity Quiet

C:\projects\format_test>dotnet build FormatTest.sln --verbosity Quiet
MSBuild version 17.4.0+18d5aef85 for .NET

Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:01.46

C:\projects\format_test>dotnet pack FormatTest.sln --verbosity Quiet
MSBuild version 17.4.0+18d5aef85 for .NET

C:\projects\format_test>dotnet format FormatTest.sln --verbosity Quiet --verify-no-changes
Argument 'Quiet' not recognized. Must be one of:
'q'
'quiet'
'm'
'minimal'
'n'
'normal'
'd'
'detailed'
'diag'
'diagnostic'

Description:
Formats code to match editorconfig settings.

Usage:
dotnet-format [] [command] [options]

Arguments:
The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. [default: C:\projects\format_test\]

Options:
--diagnostics A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. []
--exclude-diagnostics A space separated list of diagnostic ids to ignore when fixing code style or 3rd party issues. []
--severity The severity of diagnostics to fix. Allowed values are info, warn, and error.
--no-restore Doesn't execute an implicit restore before formatting.
--verify-no-changes Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted.
--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. []
--include-generated Format files generated by the SDK.
-v, --verbosity Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]
--binarylog Log all project or solution load information to a binary log file.
--report Accepts a file path which if provided will produce a json report in the given directory.
--version Show version information
-?, -h, --help Show help and usage information

Commands:
whitespace Run whitespace formatting. [default: C:\projects\format_test\]
style Run code style analyzers and apply fixes. [default: C:\projects\format_test\]
analyzers Run 3rd party analyzers and apply fixes. [default: C:\projects\format_test\]

C:\projects\format_test>
```

Would be really useful when `dotnet format` supports also capitalized verbosity values like `Quiet`, `Minimal`, ... and it would be consistent to other dotnet commands.

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.