mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 15:15:33 +00:00
Omit code frames for fixes with empty ranges (#12304)
## Summary Closes https://github.com/astral-sh/ruff/issues/12291. ## Test Plan ```shell ❯ cargo run check ../uv/foo --select INP /Users/crmarsh/workspace/uv/foo/bar/baz.py:1:1: INP001 File `/Users/crmarsh/workspace/uv/foo/bar/baz.py` is part of an implicit namespace package. Add an `__init__.py`. Found 1 error. ```
This commit is contained in:
parent
e58713e2ac
commit
940df67823
42 changed files with 11 additions and 457 deletions
|
@ -116,14 +116,17 @@ impl Emitter for TextEmitter {
|
|||
)?;
|
||||
|
||||
if self.flags.intersects(EmitterFlags::SHOW_SOURCE) {
|
||||
writeln!(
|
||||
writer,
|
||||
"{}",
|
||||
MessageCodeFrame {
|
||||
message,
|
||||
notebook_index
|
||||
}
|
||||
)?;
|
||||
// The `0..0` range is used to highlight file-level diagnostics.
|
||||
if message.range() != TextRange::default() {
|
||||
writeln!(
|
||||
writer,
|
||||
"{}",
|
||||
MessageCodeFrame {
|
||||
message,
|
||||
notebook_index
|
||||
}
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
if self.flags.intersects(EmitterFlags::SHOW_FIX_DIFF) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue