optimagic-dev/optimagic

Styling of yaml files

hmgaudecker opened this issue · 4 comments

Current situation

Consistent styling is helpful for many reasons. Also applies to yaml files, particularly when comparing settings across projects.

Styling of yaml files is ad-hoc.

Desired Situation

Style yaml files automatically.

Proposed implementation

Add yamlfix and yamllint hooks as described here , fix settings so that it they work in estimagic.

Based on this conversation, I had been under the impression that these were added in #420, but they did not appear.

Adding them is not fully trivial. Reasons AFAICT:

  • Fix settings of yamlfix so that yamllint does not complain when test files are changed.
  • Align the output of .envs/update_envs.py with what yamlfix will do (e.g., six spaces for the pip-installed packages, align settings yamlfix/yamllint for inline comments)

I also thought it was done as part of #420. @timmens can you have a look when you are back? It is not urgent!

Thank you for noticing this @hmgaudecker. Yes, this should've been added in #420. I should've been more careful when messing around in someone else's PR while not fully understanding what's going on.

I will take care of this issue once I'm back in the office.

No worries! Happy to look into a PR together, but no rush.

I just pushed the yaml-linting branch. I already added the hooks and ran them on files that don't cause issues.

The two items from the to-do list above are still open.