Skip to content

has_no_unused_is_incremental does not exclude code that is commented out #119

@food-spotter

Description

@food-spotter

Issue

dbt-score does not ignore commented out code for the has_no_unused_is_incremental rule.

How to recreate

Example:

{{
  config(
    materialized="table"
  )
}}

select *
from {{ source('some', 'thing') }}
where status is not null
/*
{% if is_incremental() %}
    and _sdc_batched_at > (select max(_sdc_batched_at) from {{ this }})
{% endif %}
*/

dbt-score will flag this model with has_no_unused_is_incremental score. However this is incorrect.

Have tested with the {% if is_incremental() %} being commented out with 3 different comment strategies:

  • native sql comment block - /* comment */
  • native sql line comment - -- comment
  • jinja comment block - {# comment #}

Expected

dbt-score should not trigger the has_no_unused_is_incremental rule because it is actually commented out

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions