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
Layout Rules Recode (part 2) #4456
Conversation
02d3c26
to
01401db
Compare
src/sqlfluff/utils/reflow/respace.py
Outdated
post_constraint = next_block.spacing_before if next_block else "single" | ||
# Unless align, split. | ||
if post_constraint.startswith("align"): |
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.
Can you not just loop through the constraints rather than repeating the code block?
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.
yeah that's probably a better idea... 🤔
Pull Request Test Coverage Report for Build 4331471805
💛 - Coveralls |
Pull Request Test Coverage Report for Build 4336164845
💛 - Coveralls |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #4456 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 211 204 -7
Lines 15498 15415 -83
=========================================
- Hits 15498 15415 -83
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View 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.
LGTM
@@ -291,7 +291,7 @@ above: | |||
.. code-block:: cfg | |||
|
|||
[sqlfluff] | |||
warnings = L019, L006 | |||
warnings = L019, LT01 |
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.
Oh interesting, I didn't know we were downgrading this to a warning
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.
... we're not - it's just an example 😄
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.
🙃
This is a follow on from #4432 . It's part of #4031 .
This PR is primarily about consolidating all the other spacing rules into
LT01
. This removes a lot of individual rules, but results in much less code to basically do the same thing. We rely on layout configs to allow users to tweek formats for their setup. Specifically,LT01
now combines:In the process this also revises a couple of spacing configurations. In particular I've changed
inline
to be a qualifier so that we can havesingle:inline
andtouch:inline
(where the latter was the previous meaning of justinline
). This also allows a little more modularity in the code which handles it.In the original issue - I suggested that we should also combine L015 and L017 into here too, but on closer inspection I think that's a bad idea. I'll handle them separately.