sql-formatter-org / sql-formatter

A whitespace formatter for different query languages
https://sql-formatter-org.github.io/sql-formatter/
MIT License
2.37k stars 405 forks source link

CLI option to check if a file is correctly formatted #790

Open JakobMiksch opened 1 month ago

JakobMiksch commented 1 month ago

Describe the Feature

The CLI should indicate if the SQL needs formatting or not.

Why do you want this feature?

I have a CI pipeline that should check if all SQL files in my repo comply to the standard formatting. It would be great to have an option that enables the CLI tool to return an error code if the file is not correctly formatted.

Possible implementation:

nene commented 1 month ago

Seems like a sensible feature to add.

Would you be interested in implementing it?

JakobMiksch commented 1 month ago

I fear I do not have capacity for it. The feature is currently nice-to-have but not super high priority for my use case. If I find time, I will notify you again. Thanks for your effort of creating this whole library.