Skip to content
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

Adopt JuliaFormatter.jl #118

Open
kbarros opened this issue Aug 6, 2023 · 3 comments
Open

Adopt JuliaFormatter.jl #118

kbarros opened this issue Aug 6, 2023 · 3 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@kbarros
Copy link
Member

kbarros commented Aug 6, 2023

To ensure uniformity of the Sunny source code (and in accordance with BlueStyle) I think we should run all of our .jl files through JuliaFormatter.jl.

We should also set up Github actions so that JuliaFormatter runs automatically on every commit.

JuliaFormatter allows a lot of customization, but the defaults look like a good starting point.

Many of our comments involve formatted math equations, and these should not be re-wrapped. It is possible to disable formatting on local chunks of code as described here.

@kbarros
Copy link
Member Author

kbarros commented Aug 27, 2023

Let's implement this only after the big outstanding PRs have been merged.

@kbarros kbarros self-assigned this Aug 27, 2023
@kbarros
Copy link
Member Author

kbarros commented Dec 21, 2023

Initial tests in #200.

The primary blocker is domluna/JuliaFormatter.jl#780. Are we willing to lose whitespace formatting around binary ops?

@kbarros
Copy link
Member Author

kbarros commented Jan 4, 2024

As proposed by Eric Sabo on Slack, it might be possible to implement the solution to domluna/JuliaFormatter.jl#780 ourselves. That is, we could potentially preserve white space around binary operations by implementing a custom style. This custom style could follow Blue Style, but essentially disable the behavior of p_binaryop_call as defined here. As another reference, one could follow the implementation of the whitespace_ops_in_indices option.

The disadvantage, per Eric, is that:

you have to run [the new style] manually via the command line and you can’t import your new style guidelines into VSCode

Help wanted if anyone is interested in learning about this type of Julia hacking.

@kbarros kbarros added the help wanted Extra attention is needed label Jan 4, 2024
@kbarros kbarros added help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant