-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Enforce formatting of TOML files #30128
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
Conversation
4014164
to
e57e803
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will make things tricky for developers because bootstrap isn't installing taplo, so the changes will fail on CI but not locally with test-tidy. Can we install a toml formater via pip or cargo dependencies that does the right thing?
Is there any place where I can put |
Could this be made a dev dependency of the winit port? |
Could we run cli from dev-dependencies? I think that is not possible: rust-lang/cargo#2267 |
It seems a tool like toml-sort could be installed by pip and then run unconditionally. What do you think? |
Hm, it certainly is more convenient to install via mach. I will see if I can make config for it. |
Great. That sounds like a plan. I can help out with the integration into "./mach fmt" as well. |
After reading toml-sort usage manual I am not so sure it was meant to be used this way. In taplo you can just do I think Taplo is more oriented towards users like us, that want to enforce formatting in their project and is easier to be used as standalone, while toml-sort is just utility that works for files being piped rather than on projects. |
Hrm. Maybe we can build taplo into the target directory or install it for the user with cargo during bootstrapping? |
I am working on user installation with cargo during bootstrapping. Wow how |
467e1f8
to
0470cc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for iterating on this. This is looking really good. I have a suggestion for a few minor changes.
5c511e4
to
e2af6ef
Compare
- name: Install taplo | ||
uses: baptiste0928/cargo-install@v2 | ||
with: | ||
crate: taplo-cli | ||
locked: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be installed by ./mach bootstrap
below now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be, but this way it's faster as this action will cache it. Using cargo install takes 4-5min.
- name: Install taplo | ||
uses: baptiste0928/cargo-install@v2 | ||
with: | ||
crate: taplo-cli | ||
locked: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a couple little nits before landing. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Formatting is enforced by CI rather than requiring users to install taplo as I suggested in #26728 (comment)
./mach build -d
does not report any errors./mach test-tidy
does not report any errors