Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*Multline* comments getting flagged with fct_hard_coded_references #476

Closed
guyr-ziprecruiter opened this issue Jul 4, 2024 · 1 comment
Labels
bug Something isn't working triage

Comments

@guyr-ziprecruiter
Copy link

guyr-ziprecruiter commented Jul 4, 2024

While fixed for ordinary comments:

{# we remove the comments that start with -- , or other characters configured #}
{%- set re = modules.re -%}
{%- set comment_chars_match = "(" ~ var('comment_chars') | join("|") ~ ").*" -%}
{%- set model_raw_sql_no_comments = re.sub(comment_chars_match, '', model_raw_sql) -%}

Mentioning table names inside multline comments

/*
my_database.my_table
*/

will result in a failure.

For now I switched from multiline SQL comments to jinja2 comments (which are multiline by default)

Switching the jinja2 multiline comments also does not cut it and gets flagged.

{#
my_database.my_table
#}

Fixing this could be nice 🙇 . Thanks!

@guyr-ziprecruiter guyr-ziprecruiter added bug Something isn't working triage labels Jul 4, 2024
@b-per
Copy link
Collaborator

b-per commented Jul 4, 2024

I think this is where we reach the limits of what we can do with some already complex (but not insanely complex) regex.

I'd say that the best here is either to add the line comment in your multiline comment

/*
this is some comment
-- my_database.my_table
and this is some comment as well
*/

or use Jinja comments like you did

or convert your multi-line comments to multiple single-line ones


We could technically fix your specific use case, but I don't really want to then have to maintain it for all the combinations of multiline comments for every supported data warehouse

@b-per b-per closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants