dotnet / dotnet/format

feature request: "dotnet format" mode that only formats code

Open
#1,517 7 comments 7 reactions 0 assignees View on GitHub
Area-Format untriaged
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

### Is your feature request related to a problem? Please describe.
I am trying to use "dotnet format" to keep my code formatted in a consistent way. My issue is that "dotnet format" often does things besides formatting code, it will change the way code behaves in an attempt to fix compiler errors or warnings.

### Describe the solution you'd like
I would like a console parameter like "dotnet format --format-only" the restricts its behavior to formatting changes that don't affect behavior of the code.

### Additional context
I have ran into the following undesirable changes when running dotnet format:
- adding type casts that will always fail at runtime
- adding interface implementations that will always fail (throwing not implemented exception)
- adding ObsoleteAttribute to methods I don't consider Obsolete though they are using obsolete code themselves.

I lean on the compiler often when making larger changes to see what still needs work. So subtly changing the code to address compiler errors or warning, particularly when the changes only address the compiler concern without actually working properly, is undesirable.

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.