launchbadge / sqlx

🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite.
Apache License 2.0
13.13k stars 1.24k forks source link

Support for linting queries #2866

Open iJustErikk opened 10 months ago

iJustErikk commented 10 months ago

Linting queries would be a great feature for ensuring quality of queries (for example, discouraging equality check with null).

Creating a general linter would be a very tall order. There are existing tools like sqlfluff. If we could at compile time, and convert the query into something we could pass into sqlfluff, then we could give lint warnings at compile time.

I'd like to make this feature request for now. I'll be more free in a couple weeks to hash out what the warnings should look like and play around with getting this implemented.

musjj commented 1 week ago

Did you make any progress with this? Using sqlfluff to lint sqlx queries would be very cool.