Giter Site home page Giter Site logo

formatforge's Introduction

formatforge

A simple linter for dbt (Data Build Tool) projects, designed to help you maintain clean and consistent SQL code in your dbt models. formatforge focuses on enforcing SQL style guidelines such as using leading commas, uppercase SQL keywords, and lowercase for everything else, ensuring your dbt project adheres to your business's specific coding standards.

Installation

formatforge is built with Python and can be easily installed using Poetry. Ensure you have Poetry installed; if not, follow the installation instructions on the Poetry website.

To install formatforge, clone the repository and run the following command within the cloned directory:

$ poetry add formatforge

This command creates a virtual environment and installs all necessary dependencies.

Usage

After installation, you can run formatforge to lint your dbt project files. Here's a basic example:

$ formatforge uppercase path/to/your/model.sql

Replace path/to/your/model.sql with the actual path to the SQL file you want to lint.

Options

  • --file: Specify the SQL file to lint.
  • --uppercase: Enable or disable uppercase SQL keywords. Default is enabled.
  • --leading-comma: Enable or disable leading commas. Default is enabled.

Contributing

We welcome contributions to formatforge! If you have suggestions for improvements or bug fixes, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Develop your changes and ensure they adhere to the project's coding standards.
  4. Submit a pull request with a clear description of your changes.

Please refer to CONTRIBUTING.md for more detailed information on contributing.

Reporting Issues

If you encounter any issues or have suggestions for improvements, please open an issue on GitHub with a detailed description of the problem or suggestion. Include any relevant details that could help us understand or reproduce the issue.

License

formatforge is open source and available under the MIT License.

formatforge's People

Contributors

rawlsy-py avatar

Stargazers

Chris Mitchell avatar

Watchers

 avatar Chris Mitchell avatar

formatforge's Issues

[FEATURE] CLI Interface

Is your feature request related to a problem? Please describe.
Currently, the tool lacks a user-friendly command-line interface (CLI) for specifying formatting options. Users need a simple way to apply different formatting types to their SQL files without manually editing the code or using complex commands.

Describe the solution you'd like
I would like a CLI interface developed using Typer, which provides flags for each formatting option. The CLI should allow users to easily specify whether they want to apply uppercase conversion to SQL keywords, use leading commas, or apply other formatting types we might introduce in the future. For instance, users should be able to use commands like the following:

dbt-lint format --uppercase --leading-comma path/to/file.sql

This command would apply both uppercase conversion and leading comma formatting to the specified SQL file.

Describe alternatives you've considered
An alternative could be a configuration file where users specify their formatting preferences. However, this might not be as straightforward for one-off formatting tasks or when different files require different formatting styles.

Additional Context
The CLI interface should be intuitive and easy to use, with clear help documentation that explains each flag and its effect on the formatting. Integration with Typer will also allow for future expansion of the tool with additional commands and options.

[FEATURE] Uppercase SQL Keywords

Is your feature request related to a problem? Please describe.
Existing linters format SQL keywords to lowercase. I would prefer this to be uppercase to distinguish SQL Keywords from my code, tables, expressions, etc.

Describe the solution you'd like
When I run the CLI tool providing the file address and the --uppercase flag, it will update SQL keywords such as SELECT, FROM, WHERE in the file to be uppercase

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.