SQLFluff is a mature, actively maintained SQL linter and auto-formatter with production scope far beyond a simple style checker. It exposes both a Click-based CLI and a Python API (lint, fix, parse, list_rules, list_dialects) and supports over 30 SQL dialects, including ANSI, BigQuery, Snowflake, Postgres, T-SQL, Oracle, Databricks, ClickHouse, and DuckDB. The core pipeline discovers files, optionally expands Jinja/dbt/SQLMesh templating, lexes and parses SQL into a segment tree, then applies configurable rule crawlers that emit lint violations and in many cases generate auto-fixes. The implementation is layered: a public API and CLI wrap a core linter, a grammar-combinator parser, a rule framework with fix primitives, a hierarchical config system, and a pluggy-based plugin host. A Rust workspace (sqlfluffrs) provides an optional high-performance lexer/parser and partial Rust-native rule detection, with extensive Python/Rust parity tests to keep behavior aligned.
pgFormatter is a mature, widely-used SQL formatter specifically designed for PostgreSQL. It operates as a command-line tool, a CGI web service, and a library, providing consistent formatting of SQL statements according to configurable rules (keyword case, indentation, comma placement, line width, etc.). The core formatting logic resides in the self-contained Perl module `lib/pgFormatter/Beautify.pm`, which parses SQL tokens and reformats them based on a comprehensive set of rules. The project includes a vast regression test suite derived from PostgreSQL's own regression tests, ensuring high syntax coverage and correctness across DDL, DML, procedural code, and edge cases. It also offers pre-commit hook integration and Docker deployment for CI/CD pipelines. The codebase is well-structured, actively maintained, and demonstrates strong engineering practices with isolated modules and extensive test coverage.