sqlc-dev / sqlc-gen-python

MIT License
154 stars 19 forks source link

Format Generate Code with Ruff #39

Closed devstein closed 8 months ago

devstein commented 10 months ago

Ruff has become the go-to linter and auto-formatter.

It would be great if the generate code was automatically formatted by ruff. Right now, internally we use a script to

  1. Run sqlc generate
  2. Run ruff on the output directory

Happy to contribute if this makes sense

kyleconroy commented 10 months ago

Adding Ruff isn't impossible, but it's going to be a bit difficult. This plugin is compiled to WASM. Since Ruff is written in Rust, we'd need to first compile it to a WASM module and then execute that module using wazero. It's WASM inside WASM.

Since Ruff has configuration options, I think it's probably best to continue to run ruff after generate, but you can try to do the above if you'd like.

eberkund commented 10 months ago

What I do is simply ignore generated code from my formatting and linting rules.