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

Setting is_fix_compatible on JJ01 results in runaway fix. #4474

Closed
3 tasks done
alanmcruickshank opened this issue Mar 6, 2023 · 0 comments · Fixed by #4495
Closed
3 tasks done

Setting is_fix_compatible on JJ01 results in runaway fix. #4474

alanmcruickshank opened this issue Mar 6, 2023 · 0 comments · Fixed by #4495
Assignees
Labels
bug Something isn't working

Comments

@alanmcruickshank
Copy link
Member

Search before asking

  • I searched the issues and found no similar issues.

What Happened

I set is_fix_compatible = True in #4473 and it resulted in spiralling errors. This means at the moment, the rule is not documented as fixable in the docs.

Expected Behaviour

I expected it to work nicely.

Observed Behaviour

Looking at the logs I see the line:

DEBUG    sqlfluff.linter:base.py:1335 Matched fix for JJ01 against segment: <LintFix: replace placeholder@[L:  1, P: 15] src-edt:[SourceFix(edit='{%+ if true -%}', source_slice=slice(14, 27, None), templated_slice=slice(14, 14, None)), SourceFix(edit='{%+ if true -%}', source_slice=slice(14, 27, None), templated_slice=slice(14, 14, None)), SourceFix(edit='{%+ if true -%}', source_slice=slice(14, 27, None), templated_slice=slice(14, 14, None)), SourceFix(edit='{%+ if true -%}', source_slice=slice(14, 27, None), templated_slice=slice(14, 14, None)), SourceFix(edit='{%+ if true -%}', source_slice=slice(14, 27, None), templated_slice=slice(14, 14, None)), SourceFix(edit='{%+ if true -%}', source_slice=slice(14, 27, None), templated_slice=slice(14, 14, None)), SourceFix(edit='{%+ if true -%}', source_slice=slice(14, 27, None), templated_slice=slice(14, 14, None)), SourceFix(edit='{%+ if true -%}', source_slice=slice(14, 27, None), templated_slice=slice(14, 14, None)), SourceFix(edit='{%+ if true -%}', source_slice=slice(14, 27, None), templated_slice=slice(14, 14, None)), SourceFix(edit='{%+ if true -%}', source_slice=slice(14, 27, None), templated_slice=slice(14, 14, None))]> -> <TemplateSegment: ([L:  1, P: 15]) ''>

Which appears to indicate that the rule doesn't cope well with looping in the fix phase. I think the combination of source fixes and rules which loop is not a good one.

How to reproduce

Set is_fix_compatible = True in JJ01 and the yaml tests for JJ01 will fail (or at least two of them will).

Dialect

ansi

Version

main as at 9c2ce9e

Configuration

default

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

@alanmcruickshank alanmcruickshank added the bug Something isn't working label Mar 6, 2023
@alanmcruickshank alanmcruickshank self-assigned this Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant