From ccfd453dfe34aeb098df55a34685e6f8584fe7c4 Mon Sep 17 00:00:00 2001 From: Stijnvandenbroek Date: Fri, 6 Mar 2026 10:49:12 +0000 Subject: [PATCH] feat: global sql linting --- .github/workflows/ci.yml | 4 +--- .pre-commit-config.yaml | 9 ++++++++- Makefile | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 014c99b..ae2d1a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,9 +43,7 @@ jobs: run: uv sync - name: SQLFluff lint - run: - uv run sqlfluff lint dbt/models data_platform/assets/ingestion/funda/sql --dialect - postgres + run: uv run sqlfluff lint dbt/models data_platform/ --dialect postgres lint-yaml-json-md: name: Prettier (YAML / JSON / Markdown) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a56025..d0a4ee9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,12 +14,19 @@ repos: language: system types: [python] + - id: sqlfluff-fix + name: sqlfluff fix + entry: uv run sqlfluff fix --force --dialect postgres + language: system + types: [sql] + exclude: ^(dbt/target/|dbt/dbt_packages/) + - id: sqlfluff-lint name: sqlfluff lint entry: uv run sqlfluff lint --dialect postgres language: system types: [sql] - files: ^(dbt/models/|data_platform/assets/ingestion/) + exclude: ^(dbt/target/|dbt/dbt_packages/) - id: prettier name: prettier diff --git a/Makefile b/Makefile index c3e12d9..103dcae 100644 --- a/Makefile +++ b/Makefile @@ -92,8 +92,8 @@ lint-python: ## Ruff lint + format check uv run ruff check . uv run ruff format --check . -lint-sql: ## SQLFluff lint on dbt/models and ingestion SQL - uv run sqlfluff lint dbt/models data_platform/assets/ingestion/funda/sql --dialect postgres +lint-sql: ## SQLFluff lint all SQL (excl. dbt vendor/target dirs) + uv run sqlfluff lint dbt/models data_platform/ --dialect postgres lint-format: ## Prettier check (YAML / Markdown) npx --yes prettier --check "**/*.yml" "**/*.yaml" "**/*.md" \ @@ -102,7 +102,7 @@ lint-format: ## Prettier check (YAML / Markdown) lint-fix: ## Auto-fix all linters (ruff + sqlfluff + prettier) uv run ruff check --fix . uv run ruff format . - uv run sqlfluff fix dbt/models data_platform/assets/ingestion/funda/sql --dialect postgres + uv run sqlfluff fix dbt/models data_platform/ --dialect postgres npx --yes prettier --write "**/*.yml" "**/*.yaml" "**/*.md" \ --ignore-path .prettierignore