Skip to content

fix dbt lint warnings - #51

Open
afeld wants to merge 1 commit into
metaplane:mainfrom
afeld:lint-fixes
Open

fix dbt lint warnings#51
afeld wants to merge 1 commit into
metaplane:mainfrom
afeld:lint-fixes

Conversation

@afeld

@afeld afeld commented Jun 23, 2026

Copy link
Copy Markdown

Summary of Changes

Fixed linting errors via:

dbt lint --fix

using Fusion.

https://docs.getdbt.com/reference/commands/lint?version=2.0

I couldn't get it to run in this repository directly, so I added this repository as a local package and ran from my dbt project.

Why Do We Need These Changes

My project uses dbt Fusion. Running dbt lint from there was giving me a number of linting warnings:

$ dbt lint
...
============================================================================================= Errors and Warnings =============================================================================================
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{ regexp_query}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/regex/regexp_instr.sql:79:8
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{ " and " if match_on == "all" else " or "}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql:11:5
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {% macro default__quantile(field, quantile, partition)  -%} [JJ01]
  --> dbt_packages/dbt_expectations/macros/math/percentile_cont.sql:5:1
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{ regexp_query}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/regex/regexp_instr.sql:79:35
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {# Flag syntax is xyz (set) or -xyz (clear) or xy-z (set xy, clear z).  #} [JJ01]
  --> dbt_packages/dbt_expectations/macros/regex/regexp_instr.sql:100:1
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {# Regex explanation: do not allow consecutive dashes, accept all re2 flags and clear operator, do not end with a dash  #} [JJ01]
  --> dbt_packages/dbt_expectations/macros/regex/regexp_instr.sql:102:1
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {# timestamp  -------------------------------------------------     #} [JJ01]
  --> dbt_packages/dbt_expectations/macros/utils/datatypes.sql:1:1
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {# datetime  -------------------------------------------------     #} [JJ01]
  --> dbt_packages/dbt_expectations/macros/utils/datatypes.sql:22:1
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{ " and " if match_on == "all" else " or "}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql:13:1
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {%- endif  %} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql:34:13
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{  dbt_expectations.group_by(group_by | length) }} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql:39:5
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {%- endif  %} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql:37:13
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{  dbt_expectations.group_by(group_by | length) }} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql:51:5
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{ target_tz}} [JJ01]
  --> dbt_packages/dbt_date/macros/calendar_date/convert_timezone.sql:16:39
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{  dbt_expectations.group_by(1 + group_by_length) }} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql:72:9
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{  dbt_expectations.group_by(group_by | length) }} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql:27:5
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{interval}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql:68:18
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{ dbt.dateadd(
            date_part,
            "mod(
                cast(" ~ dbt.datediff("'" ~ start_date ~ "'", date_col, date_part) ~ " as " ~ dbt.type_int() ~ " ),
                cast(" ~ interval ~ " as  " ~ dbt.type_int() ~ " )
            ) * (-1)",
            "cast( " ~ dbt.date_trunc(date_part, date_col) ~ " as  " ~ dbt_expectations.type_datetime() ~ ")"
        )}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql:90:9
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{date_part}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql:108:14
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {%- if row_condition  %} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql:28:5
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{adapter.quote("n_records")}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql:42:21
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{sum_total}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql:13:44
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {% test expect_select_column_values_to_be_unique_within_record(model,
                                                    column_list,
                                                    quote_columns=False,
                                                    ignore_row_if="all_values_are_missing",
                                                    row_condition=None
                                                    )  -%} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql:1:1
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {%- if row_condition  %} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql:32:5
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{ " and " if match_on == "all" else " or "}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql:11:5
[warning] [JinjaPadding (dbt0175)]: Jinja tags should have a single whitespace on either side: {{ " and " if match_on == "all" else " or "}} [JJ01]
  --> dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql:13:5

============================================================================================== Execution Summary ==============================================================================================
Finished 'lint' with 26 warnings

I was able to work around that by adding dbt_packages/ to a .sqlfluffignore, but figured others would run into this problem, so creating this pull request to avoid the problem.

Reviewers

@GuruM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant