postgres-language-server icon indicating copy to clipboard operation
postgres-language-server copied to clipboard

refactor: config codegen

Open psteinroe opened this issue 1 month ago • 1 comments

rewires the pgls_configuration crate alongside its codegen xtask as a preparation for new lint tools (splinter and pglinter). its all the same as before, I just moved things in the config crate around, and the xtask is geared towards tools vs just the analyser. common primitives are now in /rules/, and we generate one dir per tool (linter, splinter, pglinter) etc.

the codegen refactoring was initially written by me but completed by Claude. Everything outside of xtask/ was done by hand or is re-generated.

TODO (in follow-up prs)

  • Rename pgls_analyser crate to pgls_linter
  • Create pgls_pglinter, pgls_splinter and pgls_assists and integrate them with pgls_analyse to allow a RuleVisitor to collect the metadata
  • Simplify common patterns between linter/splinter/pglinter - I think we can cleanup Analyser a bit.

psteinroe avatar Nov 04 '25 09:11 psteinroe

Looks good!

The way I understand it is: "rules" are an abstraction layer over lints, actions, transformations.

Then the "lints" will come from many tools: splinter, pglinter, and so on.

What's still throwing me off a bit is that our lint rules (mostly squawk, eugene, typecheck?) are called "linter" right now. Maybe we can somehow make it more clear that linter is one of many linters by naming it "internal" or something?

The idea is that "rules" are the abstraction for not only lints, actions and transformations, but also for diagnostics emitted from other tools such as splinter.

and the linter is the "source code rules engine", and it emits "normal" lints. we will then add another crate for assists and transformations if we need them.

The other tools (eg splinter) are also declaring "rules" and emit diagnostics for rules, but are not declared as "linter".

But I agree that it's not 100% perfect. Open to suggestions, but I have troubles finding a name for the "source code linter" that is not "linter".

psteinroe avatar Nov 07 '25 11:11 psteinroe

Alright, let's merge it!

juleswritescode avatar Nov 19 '25 08:11 juleswritescode