Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions docs/core/tools/dotnet-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,25 @@ The `dotnet format style` subcommand only runs formatting rules associated with

* **`--diagnostics <DIAGNOSTICS>`**

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).
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).

* **`--severity`**

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

### Analyzers

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

#### Description

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).
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).

##### Options

* **`--diagnostics <DIAGNOSTICS>`**

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).
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.

* **`--severity`**

Expand Down Expand Up @@ -154,3 +154,27 @@ The `dotnet format analyzers` subcommand only runs formatting rules associated w
```dotnetcli
dotnet format --include ./src/ ./tests/ --exclude ./src/submodule-a/
```

* Fix a specific **code style** issue:

```dotnetcli
dotnet format style --diagnostics IDE0005 --severity info
```

* Fix all **code style** issues that have severity `info`, `warning` or `error`:

```dotnetcli
dotnet format style --severity info
```

* Fix a specific (non code style) analyzer issue:

```dotnetcli
dotnet format analyzers --diagnostics CA1831 --severity warn
```

* Fix all non code style issues that have severity `info`, `warning` or `error`:

```dotnetcli
dotnet format analyzers --severity info
```