ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Linting for yaml and toml file

Open VascoSch92 opened this issue 5 months ago • 5 comments

Hey 👋

If I'm correct, there are not rules which target .yaml or .toml config files.

  • Could be interesting to format also these types of files?
  • Is this already a things?

VascoSch92 avatar Mar 04 '24 09:03 VascoSch92

I am sure they have a lot of work with Python rules, 677 open issues at that moment. But, yes, would be nice to have yaml, json, toml, xml formatters included. For example, I tried many different tools for autoformating xml and almost all of them had some issues (or I had issues with configuring them), perhaps prettier was ok, but still not started using it, partially because of node.js dependency.

ashrub-holvi avatar Mar 04 '24 11:03 ashrub-holvi

Yeah that would be neat. It's not our primary focus for now. There's still a lot to do on the Python front.

Related to https://github.com/astral-sh/ruff/issues/9244

MichaReiser avatar Mar 04 '24 12:03 MichaReiser

I am even thinking that pre-commit hook should have a check which will fail if you are trying to add a file of type which has no autoformatter configured )

ashrub-holvi avatar Mar 04 '24 17:03 ashrub-holvi

@ashrub-holvi

I agree it would be nice if ruff could format/lint toml + yaml but it is possible to use prettier for this without requiring node to be a project dependency. Just use the pre-commit hook and the pre-commit-ci.

Example https://github.com/great-expectations/great_expectations/blob/200c968b5b5c6b19d5d2d63ca0d6fe1835b94b62/.pre-commit-config.yaml#L27-L32

Kilo59 avatar Mar 30 '24 00:03 Kilo59

@Kilo59 yes, thanks, I know it't not a project dependency, in my case it was minor/temporary issue because of outdated node version in CI - upgrade was blocked by other stuff for some time. But still - less js is good )

ashrub-holvi avatar Apr 02 '24 07:04 ashrub-holvi