tconbeer / sqlfmt

sqlfmt formats your dbt SQL files so you don't have to
https://sqlfmt.com
Apache License 2.0
373 stars 15 forks source link

sqlfmt + reviewdog #532

Open ryaminal opened 7 months ago

ryaminal commented 7 months ago

Curious if anyone has used sqlfmt with reviewdog. A pretty nifty tool that automatically creates PR comments for format changes.

It likely won't be too tricky to get it to work, but thought I'd ask everyone if it has already been done and potentially document here for future users.

tconbeer commented 7 months ago

Not that I know of; I'd love to hear how it goes for you.

sqlfmt produces something very close to "unified diff" with the --diff option, so it might just work? I had never heard of ReviewDog, but had a similar thought in #259; the API seemed tough so I deprioritized it, though. If reviewdog is easy to set up I'd love to add that to the docs.

And if you want to open a PR here with changes to --diff (or a new option) that outputs a format for reviewdog, I'd welcome that contribution.

ryaminal commented 7 months ago

Excellent. We've only recently learned about reviewdog and it's pretty slick with github PRs and stuff.

Reviewdog supports a few formats, but we'll try it with plain --diff output and hope that works. If not we can explore a sarif or rdjson flag in sqlfmt, perhaps.

Thanks for the response. Will update this ticket when we have next steps.