-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Apply Runic formatting #4568
base: master
Are you sure you want to change the base?
Apply Runic formatting #4568
Conversation
Cool! I only took a look at the first ~10 files, but so far I'm pretty happy with the formatting changes! |
2667ab4
to
63be8e6
Compare
I experimented a bit with this and the easiest seem to be to
and then run the formatter again and commit the changes. Edit: If the branch already have conflicts I suppose one should rebase on the commit just before the runic commit just so |
24c5270
to
fd06a1c
Compare
fd06a1c
to
83c6329
Compare
Rebased. |
Note that with fredrikekre/Runic.jl#122 you can instead adopt Runic formatting incrementally only for changes that are modified and added with each commit. |
This is a draft PR to try out Runic for code formatting after discussion with @SimonDanisch.
Currently this PR only contains the "raw" Runic formatting with no manual changes, and only for files in
src
. When applying Runic to other code bases (for example Documenter.jl in JuliaDocs/Documenter.jl#2591 JuliaDocs/Documenter.jl#2564) there are a couple of things one might want to check manually (not for correctness, but for aesthetics).Runic adds
return
in front of the last expression in function bodys but this doesn't recurse intotry
andif
, for example. Therefore, one might want to change e.g.to
depending on what you prefer.
In other cases one might want to be more explicit with what is to be returned (which Runic formatting forces you to do in a sense). For example, in this repo there are many cases of this pattern:
which after formatting now become
The API of
plot!
is to returnp
(right?), but here it couples directly to the return value oflines!
. Personally I would then rewrite this intojust to make it a bit more clear, and to make sure that if the API of
lines!
changes it doesn't affect the return value ofplot!
.If you choose to adopt Runic I think the way we did it in Documenter.jl is a good way: First merge a PR with the "raw" formatting and then make another PR with manual changes just to make it clear what changes are Runic's and what changes are manual. These commits can then be added to a
.git-blame-ignore-revs
file so thatgit blame
doesn't show these commits, see https://github.com/fredrikekre/Runic.jl?tab=readme-ov-file#ignore-formatting-commits-in-git-blame for details.The changes here were generated with what I hope to be Runic version 1.0.0. I looked at the patch myself and I didn't see anything I would consider Runic bugs, but I would still be curious if you have any feedback or questions about the actual style.