Skip to content

Commit 03c672c

Browse files
authored
Stabilize --output-format in --watch mode (#22908)
Summary -- This PR stabilizes the changes from #21097 and closes #19552. Note that this has two effects: - the default output format in `--watch` mode becomes `full` instead of `concise` - the `--output-format` flag will now be respected So the default output is now more verbose, but the old stable behavior can be retained by passing `--output-format=concise` (or any other supported format) instead. Test Plan -- Manual testing. I think we tried to set up automated tests in an earlier PR but decided they were too complex. I really should have cropped these, but I'll just collapse them instead: <details><summary>Screenshots</summary> <p> ### Current output, no `--output-format` <img width="783" height="514" alt="image" src="https://github.com/user-attachments/assets/a758daa8-534e-4dab-9cff-858321cede61" /> ### Current output, `--output-format=json` The same as above, the flag has no effect <img width="783" height="514" alt="image" src="https://github.com/user-attachments/assets/e5b0743a-6bd5-4dec-83e0-de24e44567ca" /> ### PR branch output, no `--output-format` Default format is now `full` rather than `concise` <img width="783" height="514" alt="image" src="https://github.com/user-attachments/assets/cf51947d-52e3-4420-83e7-73530557c324" /> ### PR branch output, `--output-format=json` JSON output, the flag works <img width="783" height="514" alt="image" src="https://github.com/user-attachments/assets/e7127c5a-88ad-4b2a-80b4-193b63b631ee" /> </p> </details>
1 parent 9b88873 commit 03c672c

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

crates/ruff/src/printer.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,19 +408,14 @@ impl Printer {
408408
}
409409

410410
let context = EmitterContext::new(&diagnostics.notebook_indexes);
411-
let format = if preview {
412-
self.format
413-
} else {
414-
OutputFormat::Concise
415-
};
416411
let config = DisplayDiagnosticConfig::default()
417412
.preview(preview)
418413
.hide_severity(true)
419414
.color(!cfg!(test) && colored::control::SHOULD_COLORIZE.should_colorize())
420415
.with_show_fix_status(show_fix_status(self.fix_mode, fixables.as_ref()))
421416
.with_fix_applicability(self.unsafe_fixes.required_applicability())
422417
.show_fix_diff(preview);
423-
render_diagnostics(writer, format, config, &context, &diagnostics.inner)?;
418+
render_diagnostics(writer, self.format, config, &context, &diagnostics.inner)?;
424419
}
425420
writer.flush()?;
426421

0 commit comments

Comments
 (0)