-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: How to csharpier in combination with dotnet-format #436
Comments
I have not yet used dotnet-format and assumed it was concerned purely with formatting style, but it looks like there are a large number that are not formatting. See https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options?view=vs-2019 From my quick testing, there are definitely going to be formatting conflicts between csharpier and dotnet-format with how they wants to format whitespace. One possibility would be modifying the way csharpier formats whitespace so that it conforms with a set of dotnet-format rules. But! It looks like dotnet-format provides a way to run subsets of rules. The doc at https://github.com/dotnet/format#how-to-use appears to be outdated, but I believe this will run all of the non-whitespace rules. Running this against csharpier results in no changes. I believe because I don't have any rules defined in an editorconfig. dotnet format --fix-style --fix-analyzers Assuming that accomplishes what you want, I can get the doc updated! |
I have not actually tested this combo myself yet. But I'll try to test your suggestion, and come back to you with results. |
The combination below seemingly works fine on dotnet-format 5! Tested it on your repo, with some changes from dotnet but no formatting, and then apply your formatting in the end. (Note for future people, # Run dotnet format without --fix-whitespace
dotnet-format --fix-style info --fix-analyzers info
# Use csharpier for formatting
dotnet csharpier . I think this can be a great combo, as dotnet-format is not opinionated enough about formatting. And csharpier has no linting. You could maybe consider promoting this combo here: dotnet/format#246 |
Awesome! I have a PR for adding this info to the doc and I also included the changes from running the command. I will probably start using dotnet-format going forward.
Someone else actually mentioned CSharpier on that issue already. I have been holding off on promoting too much until I consider CSharpier beta, and it is really close to that point now. |
Great :) Thanks for the feedback. Feel free to close this issue ✅ |
Hey, this tool looks great!
I would like to format my whitespace like
csharpier
, but also to usedotnet-format
to fix "linting".Is there a recommended approach to run both tools?
Thanks!
The text was updated successfully, but these errors were encountered: