Deltares / Wflow.jl

Hydrological modeling
https://deltares.github.io/Wflow.jl/dev/
MIT License
113 stars 18 forks source link

Enforce style guide for Julia code #435

Open CFBaptista opened 1 month ago

CFBaptista commented 1 month ago

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:

  1. YAS
  2. Blue
  3. SciML

One of these should be picked, configured and enforced.

Tasks

verseve commented 1 month ago

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.

visr commented 1 month ago

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.

CFBaptista commented 1 month ago

Okay, agreed. I am copying Ribasim's .JuliaFormatter.toml

CFBaptista commented 1 month ago

Wflow's and Ribasim's style guides are now in sync.

CFBaptista commented 1 month ago

@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?

visr commented 1 month ago

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.