trio icon indicating copy to clipboard operation
trio copied to clipboard

yaml formatting/linting

Open jakkdl opened this issue 1 year ago • 5 comments

breaking out from #3157

in flake8-async we've been using https://github.com/jumanjihouse/pre-commit-hook-yamlfmt for a while, but it mostly just handles indentation.

Looking around a bit I found yamllint, which has rules for quoting - with sufficient complexity it should satisfy @webknjaz (https://github.com/python-trio/trio/pull/3157#discussion_r1891024219) https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.quoted_strings

Neither of the above tools can enforce block- vs flow-style arrays, but I found https://lyz-code.github.io/yamlfix/#sequence-list-style

yamlfix also has some quote rules: https://lyz-code.github.io/yamlfix/#quote-basic-values

tl;dr: yamlfix should be good

jakkdl avatar Dec 22 '24 11:12 jakkdl

Yeah, I tend to use yamllint (it can be integrated into pre-commit natively). But I don't normally change many defaults. Typically, I just set the sequences not to have extra indents. The quotes toggle seems interesting, but I haven't tried it out myself.

webknjaz avatar Dec 23 '24 02:12 webknjaz

in flake8-async we've been using jumanjihouse/pre-commit-hook-yamlfmt for a while, but it mostly just handles indentation.

Oh, I didn't realize it works with the .yamllint config..

webknjaz avatar Jan 08 '25 18:01 webknjaz

in flake8-async we've been using jumanjihouse/pre-commit-hook-yamlfmt for a while, but it mostly just handles indentation.

Oh, I didn't realize it works with the .yamllint config..

Nevermind, I got confused, it doesn't.

webknjaz avatar Jan 08 '25 18:01 webknjaz

@jakkdl , I'm interested and could you kindly assign me this task.

kachida avatar Mar 31 '25 14:03 kachida

Done though you can always just make a PR regardless!

A5rocks avatar Mar 31 '25 14:03 A5rocks