otosky / pre-commit-sqlfmt

pre-commit hook for CockroachDB's Prettier SQL Formatter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker-based pre-commit hook for auto-formatting SQL files.

Runs sqlfmt - an opinionated SQL formatter based on prettier - included in the CockroachDB CLI.

Usage

add the following to your .pre-commit-config.yaml:

- repo: https://github.com/otosky/pre-commit-sqlfmt
  rev: v1.2
  hooks:
    - id: sqlfmt
      # if adding args, uncomment:
      #args: ["--use-spaces", "--print-width", "45"]

Args for sqlfmt can be found here: https://www.cockroachlabs.com/docs/v20.1/cockroach-sqlfmt.html

About

pre-commit hook for CockroachDB's Prettier SQL Formatter

License:Apache License 2.0


Languages

Language:Shell 79.8%Language:Dockerfile 20.2%