News for hackers. Stuff that matters.
Re:GlueSQL: A SQL database engine written as a library in Rust by jitl on Saturday October 22, 2022 @08:53PM (#33303553)
I’ve been thinking about writing a code analysis and refactoring tool that would expose facts like AST node info, expression typings, etc as queryable collections. To make this fast and interactive, you’d only compute the facts needed for a query and ideally incrementally maintain those as files change.

Rust used a Datalog library inside the borrow checker for this; I’d like to bring similar model to more languages so that some kinds of refactors or lints written as queries could potentially be shared between languages - for example, a lint rule that prohibits optional arguments to functions.

I wonder if GlueSQL would work naturally as this kind of “OSQuery for source code”.

Re:GlueSQL: A SQL database engine written as a library in Rust by neandrake on Saturday October 22, 2022 @09:22PM (#33303688)
This idea sounds similar to Glean. I haven’t looked too much into it yet but tagged it for later.

https://glean.software/

Re:GlueSQL: A SQL database engine written as a library in Rust by chc4 on Saturday October 22, 2022 @10:09PM (#33303932)
CodeQL is exactly the query side of this - it builds a database of facts about your code, which you can query in their language which compiles to datalog, in order to write lints (sometimes in a language-agnostic manner). It doesn't have anything for refactoring, however.