Types generated from .razor files are reported as missing
See original GitHub issueHello and thank you for an amazing tool!
We’re trying to enforce code conventions during commit hooks and dotnet-format
helps perfectly.
We’ve got troubles using new rules from Roslynator v3.1.0 introduced a new rule RCS0053 enforcing consistent indentation for lists which is the only rule I found doing so far.
By running dotnet format -wsa warn
the following errors appears:
Unable to fix RCS0053. Code fix FixFormattingOfListCodeFixProvider didn't return a Fix All action.
Unable to fix SA1306. Code fix RenameToLowerCaseCodeFixProvider didn't return a Fix All action.
Rules are working perfectly in VSCode / Intellij Rider, except of running via dotnet format
. We could live with that by manually going though the code invoking the refactoring snippets, but I see that dotnet format -wsa warn --check
bypass checks if there is no fix available assuming the code is fine.
Is there any options to return non-zero code if dotnet-format
unable see error but unable to fix so that lint-staged
would fail?
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
@gavar In your case we have performed the restore prior to running dotnet-format. I see that the App class is generated from the App.razor file. It is likely that we are not invoking the proper MSBuild task when loading the workspace to add this class to our compilation. I am going to update this issue title to track this bug.
@gavar Thanks for the excellent repro repo! =)
I found the answer reading this blog post . The file globbing library that dotnet-format uses has problems with fully rooted paths. Passing the
--relative
flag tolint-staged
in order to generate relative file paths resolves your issue.