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

[Panic] Expected docstring to start with a valid triple- or single-quote prefix #3336

Closed
qarmin opened this issue Mar 4, 2023 · 11 comments · Fixed by #3343
Closed

[Panic] Expected docstring to start with a valid triple- or single-quote prefix #3336

qarmin opened this issue Mar 4, 2023 · 11 comments · Fixed by #3343
Assignees
Labels
bug Something isn't working

Comments

@qarmin
Copy link

qarmin commented Mar 4, 2023

Ruff 0.0.254

Steps to reproduce

mkdir tt
cd tt
wget https://github.com/charliermarsh/ruff/files/10888419/AAA.zip
unzip AAA.zip
python3 -m venv venv
source venv/bin/activate
pip install packaging
pip install -r requirements.txt --no-deps
ruff .

causes to crash with message

error: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:

https://github.com/charliermarsh/ruff/issues/new?title=%5BPanic%5D

quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!

thread '<unnamed>' panicked at 'internal error: entered unreachable code: Expected docstring to start with a valid triple- or single-quote prefix', crates/ruff/src/rules/pydocstyle/helpers.rs:24:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

Requirements file contains ~ 1000 the most popular python packages, mostly < 20 MB in size(I disabled some packages, that took need to download 500MB like nvidia cuda)

I suggest to check even more packages from time to time because this is quite easy way to find possible bugs in real code.

@qarmin
Copy link
Author

qarmin commented Mar 4, 2023

Found minimal example

""" SAM macro definitions """

@charliermarsh charliermarsh added the bug Something isn't working label Mar 4, 2023
@charliermarsh
Copy link
Member

Thanks!

@charliermarsh charliermarsh self-assigned this Mar 4, 2023
@charliermarsh
Copy link
Member

That minimal example doesn't panic for me, but I'll try for the full repro based on the zip file (thanks for that).

@charliermarsh
Copy link
Member

This is a very useful exercise!

@qarmin
Copy link
Author

qarmin commented Mar 4, 2023

I forgot about config file(by default there is no crash)

select = ["D"]

@charliermarsh
Copy link
Member

Is it possible that the file uses CR line endings? (Not CRLF, but CR.) I can't repro based on the snippet alone.

@charliermarsh
Copy link
Member

Alternatively, if you know which file this is in, that works too.

@qarmin
Copy link
Author

qarmin commented Mar 4, 2023

In notepad I see that file uses CL line ending and crash still happens -
ww.zip

@charliermarsh
Copy link
Member

Awesome, thank you, that I can reproduce.

@charliermarsh
Copy link
Member

There's a zero-width non-breaking space at the start of the file...

https://www.compart.com/en/unicode/U+FEFF

@charliermarsh
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants