astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
28.67k stars 928 forks source link

Linting for yaml and toml file #10227

Open VascoSch92 opened 4 months ago

VascoSch92 commented 4 months ago

Hey 👋

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

ashrub-holvi commented 4 months ago

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.

MichaReiser commented 4 months ago

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

ashrub-holvi commented 4 months ago

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 )

Kilo59 commented 3 months ago

@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

ashrub-holvi commented 3 months ago

@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 )