Skip to content

Pre-commit hook that sorts dbt doc blocks in a macro alphabetically

License

Notifications You must be signed in to change notification settings

LeopoldGabelmann/sort-dbt-docs

Repository files navigation

sort-dbt-docs

Pre-commit hook that sorts dbt doc blocks in a macro alphabetically.

This pre-commit hook only works if you make use of the docs macro within dbt, since it only iterates over markdown files and ignores yml files. It returns a standardized output of your docs with the format:

{% docs aaa %}
Documentation for aaa.
{% enddocs %}

{% docs bbb %}
Documentation for bbb.
{% enddocs %}

Usage

Add this to your .pre-commit-config.yaml:

-   repo: https://github.com/LeopoldGabelmann/sort-dbt-docs.git
    rev: v0.4.0
    hooks:
    -   id: sort-dbt-docs

To limit it to your docs folder that most likely sits within your macro folder you can add:

-   repo: https://github.com/LeopoldGabelmann/sort-dbt-docs.git
    rev: v0.4.0
    hooks:
    -   id: sort-dbt-docs
        files: (^macros/docs/)

About

Pre-commit hook that sorts dbt doc blocks in a macro alphabetically

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages