numtide / treefmt-nix

treefmt nix configuration
https://numtide.github.io/treefmt/
MIT License
258 stars 78 forks source link

Add sqlfluff, sql formatter & linter for most dialects #257

Open o-az opened 5 days ago

o-az commented 5 days ago

Is your feature request related to a problem? Please describe.

feature request to add https://github.com/sqlfluff/sqlfluff

dialects currently supported by sqlfluff

ANSI SQL SQL definition Athena BigQuery ClickHouse Databricks Db2 DuckDB Exasol Greenplum Hive Materialize MySQL Oracle PostgreSQL Redshift Snowflake SOQL SparkSQL SQLite StarRocks Teradata Transact-SQL Trino Vertica

Describe the solution you'd like

to have sqlfluff as an options for linting and formatting

Describe alternatives you've considered

Additional context

Mic92 commented 5 days ago

Is it in nixpkgs? If yes, just do a pull request.

o-az commented 5 days ago

I'm happy to do that. Just making sure the team is open to it first.

zimbatm commented 5 days ago

Happy to get PRs for any formatter in nixpkgs that adheres to the treefmt formatter spec.

o-az commented 3 days ago

@zimbatm i'm working on a pr for sqlfluff. One question: how do you decide what goes into settings and what goes into options directly?

For example I'm looking at these two and how they use include:

https://github.com/numtide/treefmt-nix/blob/main/programs/dprint.nix#L60-L65

https://github.com/numtide/treefmt-nix/blob/main/programs/nixpkgs-fmt.nix#L12-L15

it looks like settings is what would be in the formatter's config file?

update: pr to add sqlfluff https://github.com/numtide/treefmt-nix/pull/258

zimbatm commented 2 days ago

Looks good to me, once the CI passes.

I would say the rule of thumb is to use the options if the set of arguments is small (less than 10). Then shift to a config file with settings.

o-az commented 2 days ago

@zimbatm

~I checked the failure in CI and it seems it's something related to the README.md updates but not clear to me what is wrong. Any advice would be appreciated!~

update: fixed! I accidentally had sqlfluff.nix in root.