-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Panic] index out of bounds in locator.rs #3446
Comments
Hmm, very interesting that you're having success when running over individual directories. These kinds of index out-of-bounds errors are most common when run on files that use CR line endings (as opposed to LF and CRLF which are much more common). If you have a file that uses CR line endings, that could be the culprit, and that's a known issue, but without a link to the repo it's a little hard to say. |
Looks like duplicate of #3425 and this may be fixed by https://github.com/charliermarsh/ruff/pull/3439/files (not tested yet) |
Mmm...yep, found the file and its definitely some sort of hidden character thing. It does seem to be related to line endings. Just saving the file in VScode is enough and when I do a beyond compare diff the only delta is the line ending style. I have plenty of other files with CR/LF that it is fine with, so its a tad odd, but also seems like it is a known issue. Thanks for the quick responses. I'm fine with closing if this is a known issue. |
so for clarity sake most of the lines have something like: And the but I admit, I didn't check every line, maybe there is one with just CR. |
👍 Just to be clear, CR/LF is totally fine. It's CR alone that isn't properly handled right now. (My understanding is that CR alone is very rare these days, as it was last used in early versions of Mac OS. I still want to support it properly, of course.) |
I've got a particular buggy repo where I end up getting a crash here:
thread '' panicked at 'index out of bounds: the len is 1 but the index is 184', crates\ruff\src\source_code\locator.rs:71:9
The exact file it fails on changes from run to run.
I suspect maybe I'm just getting too many errors (specifically: too many failing to parse files). If I run each individual directory one at a time, then it works.
I tried setting the backtrace, but the output is too intermixed with the other warnings....Last thing I see that seems readable is:
0xerror7fffdd5655a0 - BaseThreadInitThunk:
ruff --version
== 0.0.254The TOML is setup with:
If this is too little info to help (without the actual files)...That I totally understand and feel free to reject/close this. Thanks for your time.
The text was updated successfully, but these errors were encountered: