ruff/crates/ruff_cli/tests
Charlie Marsh 195c000f5a
Avoid failed assertion when showing fixes from stdin (#8029)
## 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 https://github.com/astral-sh/ruff/issues/8027.

## Test Plan

`cargo test` (notice two failures are removed)
2023-10-17 21:50:39 -04:00
..
snapshots Add cell field to JSON output format (#7664) 2023-10-13 01:06:02 +00:00
format.rs Add [format|lint].exclude options (#8000) 2023-10-18 01:15:25 +00:00
integration_test.rs Avoid failed assertion when showing fixes from stdin (#8029) 2023-10-17 21:50:39 -04:00
lint.rs Add [format|lint].exclude options (#8000) 2023-10-18 01:15:25 +00:00