Skip to content

Commit e979609

Browse files
authored
More precise explanation for dotnet format subcommands (#42422)
1 parent 1d7ffd1 commit e979609

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

docs/core/tools/dotnet-format.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,25 @@ The `dotnet format style` subcommand only runs formatting rules associated with
105105

106106
* **`--diagnostics <DIAGNOSTICS>`**
107107

108-
A space-separated list of diagnostic IDs to use as a filter when fixing code style or third-party issues. Default value is whichever IDs are listed in the *.editorconfig* file. For a list of built-in analyzer rule IDs that you can specify, see the [list of IDs for code-analysis style rules](../../fundamentals/code-analysis/style-rules/index.md).
108+
A space-separated list of diagnostic IDs to use as a filter when fixing code style issues. Default value is whichever IDs are listed in the *.editorconfig* file. For a list of built-in code style analyzer rule IDs that you can specify, see the [list of IDs for code-analysis style rules](../../fundamentals/code-analysis/style-rules/index.md).
109109

110110
* **`--severity`**
111111

112112
The minimum severity of diagnostics to fix. Allowed values are `info`, `warn`, and `error`. The default value is `warn`
113113

114114
### Analyzers
115115

116-
`dotnet format analyzers` - Formats code to match `editorconfig` settings for analyzers.
116+
`dotnet format analyzers` - Formats code to match `editorconfig` settings for analyzers (excluding code style rules).
117117

118118
#### Description
119119

120-
The `dotnet format analyzers` subcommand only runs formatting rules associated with analyzers. For a list of analyzer rules that you can specify in your `editorconfig` file, see [Code style rules](../../fundamentals/code-analysis/style-rules/index.md).
120+
The `dotnet format analyzers` subcommand only runs formatting rules associated with analyzers. For a list of analyzer rules that you can specify in your `editorconfig` file, see [Quality rules](../../fundamentals/code-analysis/quality-rules/index.md).
121121

122122
##### Options
123123

124124
* **`--diagnostics <DIAGNOSTICS>`**
125125

126-
A space-separated list of diagnostic IDs to use as a filter when fixing code style or third-party issues. Default value is whichever IDs are listed in the *.editorconfig* file. For a list of built-in analyzer rule IDs that you can specify, see the [list of IDs for code-analysis style rules](../../fundamentals/code-analysis/style-rules/index.md).
126+
A space-separated list of diagnostic IDs to use as a filter when fixing non code style issues. Default value is whichever IDs are listed in the *.editorconfig* file. For a list of built-in analyzer rule IDs that you can specify, see the [list of IDs for quality rules](../../fundamentals/code-analysis/quality-rules/index.md). For third-party analyzers refer to their documentation.
127127

128128
* **`--severity`**
129129

@@ -154,3 +154,27 @@ The `dotnet format analyzers` subcommand only runs formatting rules associated w
154154
```dotnetcli
155155
dotnet format --include ./src/ ./tests/ --exclude ./src/submodule-a/
156156
```
157+
158+
* Fix a specific **code style** issue:
159+
160+
```dotnetcli
161+
dotnet format style --diagnostics IDE0005 --severity info
162+
```
163+
164+
* Fix all **code style** issues that have severity `info`, `warning` or `error`:
165+
166+
```dotnetcli
167+
dotnet format style --severity info
168+
```
169+
170+
* Fix a specific (non code style) analyzer issue:
171+
172+
```dotnetcli
173+
dotnet format analyzers --diagnostics CA1831 --severity warn
174+
```
175+
176+
* Fix all non code style issues that have severity `info`, `warning` or `error`:
177+
178+
```dotnetcli
179+
dotnet format analyzers --severity info
180+
```

0 commit comments

Comments
 (0)