Wflow.jl
Wflow.jl copied to clipboard
Enforce style guide for Julia code
Currently, there is no style guide for wflow's Julia code. For improved code quality a consistent style across the team is needed. The most popular style guides in the Julia community are:
- YAS
- Blue
- SciML
One of these should be picked, configured and enforced.
Tasks
- [x] Add configuration file for JuliaFormatter to the git repository
- [x] Add configuration for "format on save" to the git repository
- [x] Format entire repository
Probably good to check what style the Ribasim team is using and if we can also adopt that style, so this is consistent across the Product line.
For JuliaFormatter we use the default style, with a few non-default options: https://github.com/Deltares/Ribasim/blob/main/.JuliaFormatter.toml
I should try SciML style JuliaFormatter again, I changed some parts I didn't like about it ;)
Though as a general style guide we go with https://docs.sciml.ai/SciMLStyle/stable/ since most our dependencies also do that, and I think it's the most actively maintained style guide.
Okay, agreed. I am copying Ribasim's .JuliaFormatter.toml
Wflow's and Ribasim's style guides are now in sync.
@visr while skimming through Ribasim's repository I did not see a GitHub Action that blocks a PR if code is not properly styled. Have I missed something or do you enforce consistent styling in a different way?
That's right. Since everyone is using the same VSCode dev environment with format on save, it's not really an issue. Perhaps later on we could use it as a pre-commit hook. For that I'd like JuliaFormatter to start a bit faster though.