dotnet / format

Home for the dotnet-format command

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can I use dotnet format to just generate report and not make the changes to the file.

jikuma opened this issue · comments

I have a legacy codebase, and I want to ensure that any new code added to it follows the standard coding style. My plan is to generate a report initially and commit this report. Later, during subsequent runs, I can generate a new report and compare it with the original one. If there are differences, it likely indicates that new errors have been introduced, and I can then address them.

My challenge lies in allowing users to run this tool locally. Allowing them to run the tool locally would inadvertently format all the legacy files as well. How can I prevent this from happening?

I would make a script file for your users run instead of dotnet-format directly. It would wrap dotnet format --verify-no-changes --report {reportPath}.json and could even diff or comp the generated report against your baseline report. Do note that if legacy files are modified that may move the location of the previously reported changes and would require a new baseline report to be generated.

Resolving as answered