Skip to content

feat(dblint): add pglinter - #632

Merged
psteinroe merged 16 commits into
mainfrom
feat/splinter
Feb 5, 2026
Merged

feat(dblint): add pglinter#632
psteinroe merged 16 commits into
mainfrom
feat/splinter

Conversation

@psteinroe

@psteinroe psteinroe commented Dec 29, 2025

Copy link
Copy Markdown
Collaborator

adds support for pglinter and integrate it with dblint. It reuses the existing infrastructure, and 99% of the code changes are generated.

adapted the Dockerfile to also install pglinter. Will take around 10 minutes now to build, but its all cached after that.

the initial metadata is generated from the downloaded repo. a follow-up pr will automate this too.

pglinter works in a weird way where the user defines thresholds for certain rules. e.g.

---
source: crates/pgls_pglinter/tests/diagnostics.rs
expression: content
snapshot_kind: text
---
Category: pglinter/base/howManyObjectsWithUppercase
Severity: Warning
Message: Count number of objects with uppercase in name or in columns.
Advices:
Count number of objects with uppercase in name or in columns.
[Info] Rule: B005
How to fix:
[Info]   1. Do not use uppercase for any database objects

I would much rather see the actual objects that have an uppercase in name...

Opened an issue to check in with the maintainer: pmpetit/pglinter#83

@psteinroe
psteinroe marked this pull request as draft December 29, 2025 12:49
@psteinroe psteinroe changed the title feat(dblint): add splinter feat(dblint): add pglinter Dec 29, 2025
@psteinroe
psteinroe marked this pull request as ready for review December 30, 2025 10:26

@juleswritescode juleswritescode left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet!


# Verify installation
echo "Extension control files:"
ls -la "$(pg_config --sharedir)/extension/" | grep pglinter || echo "No pglinter found"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we fail early here? right now this would be cachted after creating extension plpgsql_check, if I'm not mistaken

let mut runnable_rules = Vec::new();
for rule_code in &enabled_rules {
if disabled_in_extension.contains(rule_code) {
results.push(PglinterDiagnostic::rule_disabled_in_extension(rule_code));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it

Base automatically changed from feat/dblint to main January 11, 2026 14:55
@psteinroe
psteinroe force-pushed the feat/splinter branch 3 times, most recently from 21d62aa to 600baf6 Compare February 3, 2026 15:14
psteinroe and others added 12 commits February 3, 2026 16:25
- Add #![cfg(not(target_os = "windows"))] to skip pglinter tests on Windows
  since the pglinter extension is not available there (only Linux/macOS)
- Fix clippy warnings: use as_deref() and contains() instead of manual patterns
- Remove table_with_primary_key test since pglinter checks all tables globally,
  making a "no diagnostics for table with PK" test impossible when other tables exist
- Add plpgsql_check as dependency in test setup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add RuleMessage struct to fetch messages from pglinter.rule_messages table
- Update PglinterCache to store rule_messages HashMap
- Update from_violation() to use dynamic messages with {object} placeholder
- Fall back to hardcoded messages for older pglinter versions
- Add feature gates to indexes.rs and sequences.rs for WASM compatibility
psteinroe and others added 4 commits February 3, 2026 16:31
Update lockfile to resolve windows-sys and json-strip-comments dependencies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ization

Allow partial JSON schemas to be deserialized by defaulting missing
fields to empty vectors. This fixes WASM tests that don't provide
all schema fields.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Switch from the development branch to main which now includes
the get_violations API and rule_messages table (v1.1.0+).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@psteinroe
psteinroe merged commit 6762a67 into main Feb 5, 2026
17 of 18 checks passed
@psteinroe
psteinroe deleted the feat/splinter branch February 5, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants