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

Missing info about name of broken files when using ruff format #7247

Closed
qarmin opened this issue Sep 8, 2023 · 0 comments · Fixed by #7377
Closed

Missing info about name of broken files when using ruff format #7247

qarmin opened this issue Sep 8, 2023 · 0 comments · Fixed by #7377
Assignees
Labels
bug Something isn't working cli Related to the command-line interface formatter Related to the formatter

Comments

@qarmin
Copy link

qarmin commented Sep 8, 2023

Ruff 0.0.287 (latest changes from main branch)

Ruff check

ruff .

contains in error info about file

error: Failed to parse Broken/PY_FILE_TEST_11944308565.py:1:1: Unexpected token Indent
warning: Linting panicked A/Untitled Folder/295_IDX_0_RAND_65295806300875131446962.py: This indicates a bug in `ruff`. If you could open an issue at:

https://github.com/astral-sh/ruff/issues/new?title=%5BLinter%20panic%5D

with the relevant file contents, the `pyproject.toml` settings, and the following stack trace, we'd be very appreciative!

panicked at 'called `Result::unwrap()` on an `Err` value: TryFromIntError(())', crates/ruff/src/noqa.rs:132:59

but

ruff format . --check

do not contains info about files

error: error=source contains syntax errors: ParseError { error: UnrecognizedToken(Async, Some("name")), offset: 787, source_path: "<filename>" }
error: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:

https://github.com/astral-sh/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 'slice index starts at 2 but ends at 1', crates/ruff_python_formatter/src/expression/binary_like.rs:472:27
@qarmin qarmin changed the title Missing info about broken files when using ruff format Missing info about name of broken files when using ruff format Sep 8, 2023
@MichaReiser MichaReiser added bug Something isn't working formatter Related to the formatter labels Sep 8, 2023
@MichaReiser MichaReiser added this to the Formatter: Beta milestone Sep 8, 2023
@charliermarsh charliermarsh self-assigned this Sep 12, 2023
@MichaReiser MichaReiser added the cli Related to the command-line interface label Sep 13, 2023
charliermarsh added a commit that referenced this issue Sep 14, 2023
## Summary

This PR ensures that we catch and render panics in the formatter
identically to other kinds of errors. It also improves the consistency
in error rendering throughout and makes a few stylistic changes to the
messages.

Closes #7247.

## Test Plan

I created a file `foo.py` with a syntax error, and a file `bar.py` with
an intentional panic.

<img width="1624" alt="Screen Shot 2023-09-13 at 10 25 22 PM"
src="https://github.com/astral-sh/ruff/assets/1309177/605c2839-ad02-4376-a2e9-d5a593ab660f">

<img width="1624" alt="Screen Shot 2023-09-13 at 10 25 24 PM"
src="https://github.com/astral-sh/ruff/assets/1309177/b1381909-157c-48cb-9630-d0bbfcb1b640">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Related to the command-line interface formatter Related to the formatter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants