You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, If I try check file from stdin ruff crashed, but it printed errors.
error: Ruff crashed. 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 'main' panicked at 'assertion failed: total > 0', crates/ruff_cli/src/printer.rs:470:5note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace-:1:19: F401 [*] `.vars.TokenVar` imported but unused-:1:29: F401 [*] `.vars.UserVar` imported but unused
## Summary
When linting, we store a map from file path to fixes, which we then use
to show a fix summary in the printer.
In the printer, we assume that if the map is non-empty, then we have at
least one fix. But this isn't enforced by the fix struct, since you can
have an entry from (file path) to (empty fix table). In practice, this
only bites us when linting from `stdin`, since when linting across
multiple files, we have an `AddAssign` on `Diagnostics` that avoids
adding empty entries to the map. When linting from `stdin`, we create
the map directly, and so it _is_ possible to have a non-empty map that
doesn't contain any fixes, leading to a panic.
This PR introduces a dedicated struct to make these constraints part of
the formal interface.
Closes#8027.
## Test Plan
`cargo test` (notice two failures are removed)
Hello, If I try check file from stdin ruff crashed, but it printed errors.
example file
example config
command:
cat src/__init__.py | ruff check -
The text was updated successfully, but these errors were encountered: