DiamondLightSource / python-copier-template

Diamond's opinionated copier template for pure Python projects managed by pip
Apache License 2.0
5 stars 3 forks source link

YAML Formatting VSCode Settings #207

Open callumforrester opened 4 weeks ago

callumforrester commented 4 weeks ago

Different people may have different default YAML formatters configured in their user settings. These may even fight each other in multi-author PRs and similar. We should decide on one and put it in the repo settings.

Acceptance Critera

coretl commented 4 weeks ago

We have https://github.com/DiamondLightSource/python-copier-template/blob/3f7684c7698839aa005b5104bb761a5470d248af/.vscode/settings.json#L4 and https://github.com/DiamondLightSource/python-copier-template/blob/3f7684c7698839aa005b5104bb761a5470d248af/.devcontainer/devcontainer.json#L23 which on my vscode seems to format to 2 space indent.

It's a shame there isn't an associated pre-commit hook for the vscode yaml plugin...

callumforrester commented 3 weeks ago

Hmm, can we move the devcontainer line to the vscode settings so it works outside a devcontainer as well?

coretl commented 3 weeks ago

This line? https://github.com/DiamondLightSource/python-copier-template/blob/3f7684c7698839aa005b5104bb761a5470d248af/.devcontainer/devcontainer.json#L23 At the moment the only "outside the devcontainer" recommendation is: https://github.com/DiamondLightSource/python-copier-template/blob/3f7684c7698839aa005b5104bb761a5470d248af/.vscode/extensions.json#L3 We could duplicate the devcontainer.json section into extensions.json and then you would be prompted to install some extensions outside the devcontainer as well as inside. Do we want that?

callumforrester commented 3 weeks ago

From offline discussion: The impetus for this issue was two developers with two different YAML formatting plugins that disagreed with each other. As the two worked on the same PR together the YAML would change back and forth with each push. It probably does make sense, given that we have that following in setting.json:

"[python]": {
    "editor.defaultFormatter": "charliermarsh.ruff",
},

which basically says "whatever you have installed, use ruff", to do the same for the RedHat YAML plugin.

However, there needs to be a discussion about just how opinionated we are willing to get about using devcontainers.