Re:Sqlfluff the SQL Linter for Humans
by ErunamoJAZZ on Wednesday October 06, 2021 @10:17AM
(#28773473)
I wanted to use this linter, but they don't support many things that are used in real production code.
By example, a simple postgres function like this one can't be parsed:
[ Parent
| on HN ]
The code looks really great [1], very declarative, looks like it should be pretty easy to add better PostgreSQL support. I also wonder if how easy it would be to plug it into VS Code, and build in an auto formatter (♥ω♥ ). At a glance it looks like it's parsing AST, which is really hard to find for SQL, so auto formatter could be possible to build from this. I notice SQLite could use some improving too, seems like a great project to coalesce around.
[1] https://github.com/sqlfluff/sqlfluff/blob/main/src/sqlfluff/...
Auto-formatter is already built in for some simple violations: https://docs.sqlfluff.com/en/stable/cli.html#sqlfluff-fix
Re:Sqlfluff the SQL Linter for Humans
by tunetheweb on Wednesday October 06, 2021 @02:11PM
(#28776289)
There already is a VS Code extension for this:
https://marketplace.visualstudio.com/items?itemName=dorzey.v...
Re:Sqlfluff the SQL Linter for Humans
by tunetheweb on Wednesday October 06, 2021 @01:19PM
(#28775694)
Looks like we didn't support SETOF.
Added this here: https://github.com/sqlfluff/sqlfluff/pull/1522
Demonstrating how easy it is to add this sort of thing to the project thanks to how the code is structured! :-)
I really personally dislike how you fail to shout the keywords in the above function "that actually matter" - all the set dressing and obvious stuff is capitalized - but then the meat of the function is all in lowercase hiding in the middle.