Skip to content

Conversation

M-van-alten-BW
Copy link
Contributor

In the linter, converted the value for large_file_skip_byte_limit to an integer to prevent the error in the comparison

This should fix Issue #6847 with no side effects.

Pull Request checklist

  • Please confirm you have completed any of the necessary steps below.

  • Included test cases to demonstrate any code changes, which may be one or more of the following:

    • .yml rule test cases in test/fixtures/rules/std_rule_cases.
    • .sql/.yml parser test cases in test/fixtures/dialects (note YML files can be auto generated with tox -e generate-fixture-yml).
    • Full autofix test cases in test/fixtures/linter/autofix.
    • Other.
  • Added appropriate documentation for the change.

  • Created GitHub issues for any relevant followup/future enhancements if appropriate.

Copy link
Member

@alanmcruickshank alanmcruickshank left a comment

Choose a reason for hiding this comment

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

You're on the right lines. Can I ask you to do a couple of extra things:

  1. Make a test case which covers the change you're making. I can give you some pointers if you're stuck, but if you have a look through the current test suite you'll probably be able to work out something. It should ideally cover setting this value to None, 100, 0 and "this_is_not_an_int".
  2. Add a better error message here if the conversion fails, so users know what to do about it if it happens?

limit = file_config.get("large_file_skip_byte_limit")
limit = int(file_config.get("large_file_skip_byte_limit"))
Copy link
Member

Choose a reason for hiding this comment

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

I like the approach, but at the moment this will probably just introduce another hard to ready error if someone puts in the wrong value for the config.

In particular, if the value isn't set then we'll get an error because int(None) is a ValueError think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. Originally this option was caught by an if limit: statement right below. I have moved the conversion in there and also added some more descriptive error messages in there using a try statement

Copy link
Contributor

github-actions bot commented Apr 29, 2025

Coverage Results ✅

Name    Stmts   Miss  Cover   Missing
-------------------------------------
TOTAL   19744      0   100%

249 files skipped due to complete coverage.

Copy link
Contributor

@WittierDinosaur WittierDinosaur left a comment

Choose a reason for hiding this comment

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

LGTM

@WittierDinosaur WittierDinosaur enabled auto-merge May 2, 2025 19:23
auto-merge was automatically disabled May 6, 2025 11:30

Head branch was pushed to by a user without write access

@WittierDinosaur WittierDinosaur enabled auto-merge May 8, 2025 15:40
auto-merge was automatically disabled May 12, 2025 06:34

Head branch was pushed to by a user without write access

@WittierDinosaur
Copy link
Contributor

Still got some linting errors

@M-van-alten-BW
Copy link
Contributor Author

@WittierDinosaur Thanks for rerunning. I think I've fixed the linting errors now so I hope it can pass now. Is there a way for me to test this myself btw? Then I wouldn't have to ask a contributor every time.

@keraion
Copy link
Contributor

keraion commented Jun 2, 2025

Linting here is still an issue. If you have tox installed, you can run tox -e linting to run the linting steps. You can also add the pre-commit hook with tox -e pre-commit -- install to check things before committing.

More info on setting things up can be found in the contributing docs.

@M-van-alten-BW
Copy link
Contributor Author

I once again believe I have fixed all linting issues with this PR, against all previous experience

auto-merge was automatically disabled June 10, 2025 13:51

Head branch was pushed to by a user without write access

I didn't even know commas in these places wouldn't break the code
auto-merge was automatically disabled June 10, 2025 13:59

Head branch was pushed to by a user without write access

auto-merge was automatically disabled June 12, 2025 06:44

Head branch was pushed to by a user without write access

@keraion keraion added this pull request to the merge queue Jun 12, 2025
Merged via the queue into sqlfluff:main with commit 5fa360a Jun 12, 2025
28 checks passed
thomascjohnson pushed a commit to thomascjohnson/sqlfluff that referenced this pull request Jun 17, 2025
…on, fixes Issue sqlfluff#6847 (sqlfluff#6848)

Co-authored-by: Danny Jones <51742311+WittierDinosaur@users.noreply.github.com>
Co-authored-by: Alan Cruickshank <alanmcruickshank@gmail.com>
Co-authored-by: Cameron <105471409+keraion@users.noreply.github.com>
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.

4 participants