Skip to content

quarylabs/sqruff

Repository files navigation

sqruff

SQRUFF is an innovative SQL linter and formatter for modern development environments, written in Rust. Key features include:

  • Linting: Advanced, customizable SQL linting capabilities to ensure query quality.
  • Formatting: Automated, configurable formatting for SQL code consistency.
  • Portability: Designed to be easily integrated into various development workflows.

Getting Started

Installation

macOS

You can use brew to install sqruff easily on macOS.

brew install quarylabs/quary/sqruff

Linux

Using bash:

curl -fsSL https://raw.githubusercontent.com/quarylabs/sqruff/main/install.sh | bash

For other platforms

Either download the binary from the releases page or compile it yourself and with cargo with the following commands.

rustup toolchain install nightly
cargo +nightly install sqruff
sqruff --help

Usage

Linting

To lint a SQL file or set of files, run the following command:

sqruff lint <file>
sqruff lint <file1> <file2> <file3>
sqruff lint <directory>

Fixing

To fix a single or or set of files, run the following command:

sqruff fix <file/paths/directory>

Help

To get help on the available commands and options, run the following command:

sqruff --help

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines on how to contribute.

Releasing

  1. Bump the versions in sqruff-lib/Cargo.toml and sqruff/Cargo.toml.
  2. Commit the changes.
  3. Push the changes.
  4. Tag the commit with the new version
  5. Release sqruff-lib crate
cargo publish -p sqruff-lib
  1. Release sqruff crate
cargo publish -p sqruff

Community

Join the Quary community on Slack to ask questions, suggest features, or share your projects. Also feel free to raise any issues in the repository.

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines on how to contribute.

Credits/Thank you

The sqruff project wouldn't be possible without "heavy inspiration" from Sqlfluff! We're very grateful to their awesome work!