In the last week I've been struggling to understand why SQLFLUFF skips linting macros part of my project. The structure of my project is like this:
GCP_Project
|- models
|- macros
|- .sqlfluffignore
|- .sqlfluff
|- dbt_project.yml
|- .pre-commit-config.yaml
|- profiles.yml
models are stored inside models
directory and macros are in the macros
folder. Templater is set to dbt
as follows:
[sqlfluff]
verbose = 1
templater = dbt
dialect = bigquery
sql_file_exts = .sql
max_line_length = 120
rules = CP01
[sqlfluff:templater]
unwrap_wrapped_queries = true
[sqlfluff:templater:dbt]
target = nonprod
[sqlfluff:templater:jinja]
apply_dbt_builtins = true
[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = upper
after running pre-commit run --all-files
, while dbt models are linted, macro files are skipped showing this message:
WARNING Skipped file /Users/.../macros/sample.sql because it is a macro
It is worth noting that if I change the templater to Jinja
only macro files get linted. My need is to have linter that lints BOTH models and macros in the project.