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

Enforce style guide for Julia code #435

Open
3 tasks done
CFBaptista opened this issue Jul 5, 2024 · 6 comments
Open
3 tasks done

Enforce style guide for Julia code #435

CFBaptista opened this issue Jul 5, 2024 · 6 comments
Assignees
Labels
v1.0 Activities related to v1.0

Comments

@CFBaptista
Copy link
Collaborator

CFBaptista commented Jul 5, 2024

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

  • Add configuration file for JuliaFormatter to the git repository
  • Add configuration for "format on save" to the git repository
  • Format entire repository
@CFBaptista CFBaptista self-assigned this Jul 5, 2024
@CFBaptista CFBaptista added the v1.0 Activities related to v1.0 label Jul 5, 2024
@verseve
Copy link
Member

verseve commented Jul 5, 2024

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
Copy link
Member

visr commented Jul 5, 2024

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
Copy link
Collaborator Author

CFBaptista commented Jul 5, 2024

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

@CFBaptista
Copy link
Collaborator Author

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

@CFBaptista
Copy link
Collaborator Author

@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
Copy link
Member

visr commented Jul 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.0 Activities related to v1.0
Projects
None yet
Development

No branches or pull requests

3 participants