sqlfluff icon indicating copy to clipboard operation
sqlfluff copied to clipboard

[DRAFT] Reflow 3: Reindent

Open alanmcruickshank opened this issue 3 years ago • 1 comments

This makes progress on #3673. It also incorporates #3936 on the assumption that it will be merged before this is ready for review.

It might also fix some other bugs, but we're not that far yet. This mostly implements the slack conversation about indentation of template elements from 8th Oct between @barrywhart and @alanmcruickshank .

Eventually this PR will include a migration of L003 into the reflow logic.

alanmcruickshank avatar Oct 08 '22 20:10 alanmcruickshank

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage :thumbsup:

Coverage data is based on head (dde5bac) compared to base (c329bb0). Patch coverage: 100.00% of modified lines in pull request are covered.

:exclamation: Current head dde5bac differs from pull request most recent head 09bfb9d. Consider uploading reports for the commit 09bfb9d to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #3942   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          196       197    +1     
  Lines        14965     14911   -54     
=========================================
- Hits         14965     14911   -54     
Impacted Files Coverage Δ
src/sqlfluff/core/config.py 100.00% <ø> (ø)
src/sqlfluff/dialects/dialect_ansi.py 100.00% <ø> (ø)
src/sqlfluff/dialects/dialect_exasol.py 100.00% <ø> (ø)
src/sqlfluff/dialects/dialect_sparksql.py 100.00% <ø> (ø)
src/sqlfluff/dialects/dialect_tsql.py 100.00% <ø> (ø)
src/sqlfluff/utils/functional/raw_file_slices.py 100.00% <ø> (ø)
...rc/sqlfluff/utils/functional/segment_predicates.py 100.00% <ø> (ø)
src/sqlfluff/core/linter/linted_file.py 100.00% <100.00%> (ø)
src/sqlfluff/core/linter/linter.py 100.00% <100.00%> (ø)
src/sqlfluff/core/parser/grammar/sequence.py 100.00% <100.00%> (ø)
... and 19 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Oct 08 '22 20:10 codecov[bot]

@barrywhart - Thanks for the first review. I think the only tricky points are:

  1. Sometimes there being an opportunity to remove newlines and condense expressions onto fewer lines. I'm planning on addressing this in the next phase of reflow (potentially still within .reindent()) but I knot that's still to do.
  2. The places which would be covered by implicit indents. #4054 .

Both of which I'm going to suggest as builds on top of this work after merging, given the current outputs are functional, if not yet optimal.

I'll keep working on both of those points, but if you're able to do a code review in the meantime then we can get this merged 👍 .

alanmcruickshank avatar Nov 11 '22 17:11 alanmcruickshank

if you're able to do a code review in the meantime then we can get this merged 👍 .

Definitely!

barrywhart avatar Nov 11 '22 18:11 barrywhart

Apart from keeping this up to date with master - this PR is ready to go.

I'm not going to merge it yet because that starts the clock ticking for 2.0.0. Will merge once everything else is teed up ready to go.

alanmcruickshank avatar Nov 16 '22 10:11 alanmcruickshank