You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tool should return error exit code if it fails to apply fixes and report the relevant warnings #1508
> dotnet formatUnable to fix IDE0060. No associated code fix found.
> dotnet format --verify-no-changes...\Program.cs(6,21): warning IDE0060: Remove unused parameter 'unused' [...csproj]<failure exit code>
I definitely understand that there are warnings which can't be fixed automatically - like removing parameters to a method. But in that case I would expect the tool to report the actual warning. Just saying the it can't fix IDE0060 doesn't help ... where? Also note that it will say this even if there are 100s warnings like that, so there's no indication of how "bad" it is.
I would also expect the tool to report failure exit code if this happens. Mainly since it should match what it does when run with --verify-no-changes.
Scenario:
In the CI, we run dotnet format --verify-no-changes to enforce the rules. The guide is: "If this fails, run dotnet format locally before PR".
But with the above if I run dotnet format it doesn't fail and it only says that it could not fix something but doesn't say what, so people tend to simply ignore that. And then it fails in CI.
If not by default, there should at least be some command line option to get a better behavior. I do know that it's possible to get the warnings with -v d, but that produces lot of additional output, which again makes it confusing.
Reacted by Sven Boemer, Justin Chase, Hamza HASSENE, Scott Phillips and Andy Zivkovic
I just got hit by this also if you add -v d it adds the info so its not like it can't it just seems like it needs to have a higher default verbosity for fixing.
Activity
justinmchase commentedon Mar 22, 2022
I just got hit by this also if you add
-v dit adds the info so its not like it can't it just seems like it needs to have a higher default verbosity for fixing.