Menu

Enforce SQL Formatting with pre-commit and GitHub Actions
📰

Enforce SQL Formatting with pre-commit and GitHub Actions

DEV Community: sql·Andrew·1 day ago
#YsLilYwA
#devtosql#devto#dev#sqlfluff#commit
Long article (2548 words) — no AI summary yet.
Reading 0:00
15s threshold

SQL style drift rarely comes from one bad decision. It comes from a hundred small ones: one developer's editor inserts two spaces after SELECT , another aligns joins differently, and a third commits a query that was formatted by a tool nobody else has installed. The pull request then contains a mix of logic changes and whitespace churn, and reviewers spend their attention on spacing instead of correctness.

Format-on-save is a personal setting, not a team policy. The reliable fix is to run the same formatter with the same configuration at two shared points: before each commit, and on every pull request.

This tutorial builds that setup with SQLFluff, a configurable SQL linter and formatter, plus pre-commit and GitHub Actions.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.