Skip to content
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

Add source fixing capability and fix routines for L046 #3578

Merged
merged 34 commits into from Jul 11, 2022

Conversation

alanmcruickshank
Copy link
Member

This follows on from the refactor PRs which I've already merged (#3552, #3567).

Quite a big one, but here's the summary:

  • Adds much better test coverage for the elements of .fix_string(). All part of the new linted_file_test.py.
  • Adds a new SourceFix dataclass and methods on segments to both add them (via .edit()) and also to retrieve them.
  • Adds capability in the linter and linted file to handle source fixes.
  • Updates L046 to use the new capabilty.
  • Adds test cases for fixing in L046.

Big PR, and a few places that could use some review.

@codecov
Copy link

codecov bot commented Jul 9, 2022

Codecov Report

Merging #3578 (faa1c68) into main (c2f530c) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main     #3578   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          174       174           
  Lines        13149     13205   +56     
=========================================
+ Hits         13149     13205   +56     
Impacted Files Coverage Δ
src/sqlfluff/core/parser/segments/__init__.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/segments/base.py 100.00% <100.00%> (ø)
src/sqlfluff/core/parser/segments/meta.py 100.00% <100.00%> (ø)
src/sqlfluff/core/parser/segments/raw.py 100.00% <100.00%> (ø)
src/sqlfluff/core/rules/base.py 100.00% <100.00%> (ø)
src/sqlfluff/rules/L046.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2f530c...faa1c68. Read the comment docs.

src/sqlfluff/core/parser/segments/base.py Show resolved Hide resolved
src/sqlfluff/core/parser/segments/base.py Outdated Show resolved Hide resolved
src/sqlfluff/core/parser/segments/base.py Outdated Show resolved Hide resolved
src/sqlfluff/core/parser/segments/raw.py Outdated Show resolved Hide resolved
test/core/linted_file_test.py Show resolved Hide resolved
alanmcruickshank and others added 4 commits July 10, 2022 09:23
Co-authored-by: Barry Hart <barrywhart@yahoo.com>
Co-authored-by: Barry Hart <barrywhart@yahoo.com>
Co-authored-by: Barry Hart <barrywhart@yahoo.com>
Co-authored-by: Barry Hart <barrywhart@yahoo.com>
@barrywhart
Copy link
Member

I'll try and review tonight. We're on vacation this week.

Copy link
Member

@barrywhart barrywhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I've thought about this for a while, but you made it happen. 💪 🎉

@alanmcruickshank alanmcruickshank merged commit 763d23e into main Jul 11, 2022
@alanmcruickshank alanmcruickshank deleted the ac/fix_refactor_3 branch July 11, 2022 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants