-
-
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
Lint spaces in qualified names #2130
Lint spaces in qualified names #2130
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2130 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 148 148
Lines 10667 10674 +7
=========================================
+ Hits 10667 10674 +7
Continue to review full report at Codecov.
|
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.
One thing that #2137 highlighted is that the changes to this rule are triggering warnings in some situations.
For example, in the unit test in test/rules/std_L003_L036_L039_combo_test.py
if you try fixing the query you'll see these warnings:
As far as I can see there's nothing in this that should be touched by your addition but it is. Can you investigate please?
query here:
WITH example AS (
SELECT my_id,
other_thing,
one_more
FROM
my_table
)
SELECT *
FROM example
Co-authored-by: Joseph Young <80432516+jpy-git@users.noreply.github.com>
Co-authored-by: Joseph Young <80432516+jpy-git@users.noreply.github.com>
Co-authored-by: Joseph Young <80432516+jpy-git@users.noreply.github.com>
…into Lint_Spaces_In_Qualified_Names
@jpy-git I looked into it just now, and it's due to #1304 as well. The real fix would be to get that issue fixed. The workaround would be to extend the workaround I added so that it ignores multiple leading whitespace segments and not just the first segment. It shouldn't be hard, but the first solutions that come to mind are all inelegant. |
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.
@jpers36 Looks good and your suggestion to handle the leading whitespace seems pragmatic 👍
Re: the incorrect parse tree issue causing those leading whitespaces in the object reference, we're well aware of the issue and it's a fairly complicated one. I'm doing some initial investigation atm. We can come back and tidy up the extra logic here in the future once that's fixed 😄
Nice work, LGTM! 🚀
Fixes #1754
This rule change adds another type of unnecessary whitespace to L039. Any whitespace or newline segments found within a reference segment type are removed.
Per @jpy-git 's suggestion this has been implemented as a change to an existing rule, but this could be spun out into its own rule if that's preferred.
Anti-pattern:
Pattern: