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 a file size check in bytes #3770

Merged
merged 5 commits into from Aug 23, 2022
Merged

Add a file size check in bytes #3770

merged 5 commits into from Aug 23, 2022

Conversation

alanmcruickshank
Copy link
Member

This resolves #3693.

Is adds another config flag (large_file_skip_byte_limit) which checks the size of the file in bytes before loading it. Very similar functionality to large_file_skip_char_limit.

I've kept the original config flag but changed the default so that it's not applied. If anyone is still using it - it will work but they'll get a deprecation warning, point them to the new flag which should be much more efficient. In a future release we can remove the old flag.

In the process I also rename SQLTemplaterSkipFile to SQLFluffSkipFile - because we're not just calling it from the templater anymore - and there's nothing particularly templater specific about it.

@codecov
Copy link

codecov bot commented Aug 22, 2022

Codecov Report

Merging #3770 (6811ab3) into main (4f3ceb9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##             main     #3770   +/-   ##
========================================
  Coverage   99.99%   100.00%           
========================================
  Files         179       179           
  Lines       13681     13699   +18     
========================================
+ Hits        13680     13699   +19     
+ Misses          1         0    -1     
Impacted Files Coverage Δ
src/sqlfluff/core/errors.py 100.00% <100.00%> (ø)
src/sqlfluff/core/linter/linter.py 100.00% <100.00%> (ø)
src/sqlfluff/core/linter/runner.py 100.00% <100.00%> (ø)
src/sqlfluff/core/templaters/base.py 100.00% <100.00%> (ø)
src/sqlfluff/rules/L004.py 100.00% <0.00%> (ø)
src/sqlfluff/core/config.py 100.00% <0.00%> (ø)
src/sqlfluff/utils/analysis/select_crawler.py 100.00% <0.00%> (ø)
src/sqlfluff/rules/L003.py 100.00% <0.00%> (+0.23%) ⬆️

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

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.

A couple of small suggestions, looks good overall.

src/sqlfluff/core/templaters/base.py Outdated Show resolved Hide resolved
src/sqlfluff/core/templaters/base.py Outdated Show resolved Hide resolved
alanmcruickshank and others added 2 commits August 22, 2022 20:48
Co-authored-by: Barry Hart <barrywhart@yahoo.com>
Co-authored-by: Barry Hart <barrywhart@yahoo.com>
@alanmcruickshank alanmcruickshank merged commit 568e698 into main Aug 23, 2022
@alanmcruickshank alanmcruickshank deleted the ac/file_size branch August 23, 2022 12:40
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.

Large files take several minutes before large_file_skip_char_limit stops parsing them
2 participants