-
-
Notifications
You must be signed in to change notification settings - Fork 750
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
Bug fix: L036 handle single-column SELECT
with comment on same line as SELECT
keyword
#3259
Bug fix: L036 handle single-column SELECT
with comment on same line as SELECT
keyword
#3259
Conversation
select_clause[0], | ||
filter_meta=True, | ||
), | ||
select_clause[0], |
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.
Unrelated to the issue, but no longer necessary to call _choose_anchor_segment()
here due to recent improvements in the core linter.
Instead of moving the select target up, before the comment, could we move the comment down after the select target (or temporary delete it)? Then fix the select target as it would if not comment was there? |
@@ -384,15 +392,25 @@ def _fixes_for_move_after_select_clause( | |||
], | |||
) | |||
|
|||
fixes += [ |
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.
Review this section with "Hide whitespace" enabled.
Codecov Report
@@ Coverage Diff @@
## main #3259 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 167 167
Lines 12531 12539 +8
=========================================
+ Hits 12531 12539 +8
Continue to review full report at Codecov.
|
@tunetheweb: We could. I don't think I'm up for tackling it now. Would you want to create a separate issue for this? Often when I look at one of these rules that moves stuff around, I am surprised how complicated it is and how many special cases arise, and how easy it is to make a mistake and corrupt the code. Here are a couple of other test cases that occur to me if we try to handle this:
🤯 I feel like rule #1 is, don't corrupt anyone's code. Auto-fixing is nice, but definitely lower priority, and the balance between effort, risk, and reward is important. |
Fair enough! |
Brief summary of the change made
Fixes #3252
Are there any other side effects of this change that we should be aware of?
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/dialects
(note YML files can be auto generated withtox -e generate-fixture-yml
).test/fixtures/linter/autofix
.Added appropriate documentation for the change.
Created GitHub issues for any relevant followup/future enhancements if appropriate.