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
Ignore erroneous newline segments in L016 (e.g. Jinja for loops) #1494
Ignore erroneous newline segments in L016 (e.g. Jinja for loops) #1494
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1494 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 130 130
Lines 8849 9061 +212
==========================================
+ Hits 8849 9061 +212
Continue to review full report at Codecov.
|
@@ -18,7 +18,6 @@ file: | |||
- newline: "\n" | |||
- whitespace: ' ' | |||
- placeholder: '{% for action in actions %}' | |||
- indent: '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good fix. These indents and dedents are not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small suggestions about comments or examples. Overall, looks like a great improvement. Huge contribution. 🎉😅
Co-authored-by: Barry Hart <barrywhart@yahoo.com>
…b/sqlfluff into better-jinja-for-loop-handling
OK this is just impossible to fix. So I went with the plain and simple option of ignoring newline segments in rule L016. Can you have a look @barrywhart ? |
Looks good! |
Brief summary of the change made
Fixes #1456 by bailing out of checking rule 16 if segment contains a newline (which shouldn't happen but can happen for for loops)
Are there any other side effects of this change that we should be aware of?
Nope. Kept it simple after attempting (and failing!) the complex way.
Pull Request checklist
Please confirm you have completed any of the necessary steps below.
Included test cases to demonstrate any code changes, which may be one or more of the following:
.yml
rule test cases intest/fixtures/rules/std_rule_cases
..sql
/.yml
parser test cases intest/fixtures/parser
(note YML files can be auto generated withpython test/generate_parse_fixture_yml.py
or by runningtox
locally).test/fixtures/linter/autofix
.Added appropriate documentation for the change.
Created GitHub issues for any relevant followup/future enhancements if appropriate.