dotnet / dotnet/sdk

[dotnet format] Different whitespace errors reported by --verify-no-changes when using indent_style = tab

Open
#43,098 0 comments 3 reactions 0 assignees View on GitHub
Area-Format untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
Different whitespace errors are reported by `--verify-no-changes` when using `indent_style = tab`.
I expected `--verify-no-changes` to report exactly the same errors that would have been fixed if this option were omitted.

This issue seems to be related to the presence of comments in the file.

See also: dotnet/format#2045

### To Reproduce
Put the following source file and .editorconfig into a new folder:
https://gist.github.com/coavins/7734bfd8d661910144b36122b092fe30
```
root = true

[*.cs]
indent_style = tab
```
There is one whitespace error included on line 13.
Run `dotnet format whitespace --folder . -v d --verify-no-changes`
See it report five whitespace errors (one for line 13 plus two more for each comment in the file)
Remove one of the comments and repeat the above command, see it report three whitespace errors.
Run `dotnet format whitespace --folder . -v d`
See it fix one whitespace error as expected.

### Further technical details

dotnet --info

.NET SDK:

Version: 8.0.401
Commit: 811edcc344
Workload version: 8.0.400-manifests.b6724b7a
MSBuild version: 17.11.4+37eb419ad

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.401\

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.

Host:
Version: 8.0.8
Architecture: x64
Commit: 08338fcaa5

.NET SDKs installed:
8.0.401 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

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.