Skip to content

Conversation

@ntBre
Copy link
Contributor

@ntBre ntBre commented Oct 27, 2025

Summary

Fixes #19550

This PR copies our non-watch diagnostic rendering code into Printer::write_continuously in preview mode, allowing it to use whatever output format is passed in.

I initially marked this as also fixing #19552, but I guess that's not true currently but will be true once this is stabilized and we can remove the warning.

Test Plan

Existing tests, but I don't think we have any watch tests, so some manual testing as well. The default with just ruff check --watch is still concise, adding just --preview still gives the full output, and then specifying any other output format works, with JSON as one example:

Screenshot 2025-10-27 at 9 21 41 AM

Summary
--

Fixes #19550, fixes #19552 (eventually)

This PR copies our non-watch diagnostic rendering code into
`Printer::write_continuously` in preview mode, allowing it to use whatever
output format is passed in.

Test Plan
--

Existing tests, but I don't think we have any `watch` tests, so some manual
testing as well:
@ntBre ntBre added cli Related to the command-line interface preview Related to preview mode features labels Oct 27, 2025
@ntBre ntBre changed the title Respect --output-format in ruff watch Respect --output-format in --watch Oct 27, 2025
@ntBre ntBre changed the title Respect --output-format in --watch Respect --output-format with --watch Oct 27, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 27, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre marked this pull request as ready for review October 27, 2025 13:47
@ntBre ntBre requested a review from MichaReiser October 27, 2025 13:47
@dylwil3
Copy link
Collaborator

dylwil3 commented Oct 27, 2025

I initially marked this as also fixing #19552, but I guess that's not true currently but will be true once this is stabilized and we can remove the warning.

Don't we generally mark the issue as closed even if the solution is in preview?

@ntBre
Copy link
Contributor Author

ntBre commented Oct 27, 2025

I initially marked this as also fixing #19552, but I guess that's not true currently but will be true once this is stabilized and we can remove the warning.

Don't we generally mark the issue as closed even if the solution is in preview?

In general yes, but this felt a little different since it's basically a preview warning.

@ntBre
Copy link
Contributor Author

ntBre commented Oct 27, 2025

Actually the warning itself probably should be updated to mention preview now, but the warning isn't being shown anyway because of #19552 🙃

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@ntBre ntBre merged commit 96b60c1 into main Oct 27, 2025
37 checks passed
@ntBre ntBre deleted the brent/watch-output-formats branch October 27, 2025 16:04
dcreager added a commit that referenced this pull request Oct 27, 2025
* origin/main:
  Respect `--output-format` with `--watch` (#21097)
  [`pyflakes`] Revert to stable behavior if imports for module lie in alternate branches for `F401` (#20878)
  Fix finding keyword range for clause header after statement ending with semicolon (#21067)
  [ty] Fix bug where ty would think all types had an `__mro__` attribute (#20995)
  Restore `indent.py` (#21094)
  [`flake8-django`] Apply `DJ001` to annotated fields (#20907)
  Clearer error message when `line-length` goes beyond threshold (#21072)
  Update upload and download artifacts github actions (#21083)
  Update dependency mdformat-mkdocs to v4.4.2 (#21088)
  Update cargo-bins/cargo-binstall action to v1.15.9 (#21086)
  Update Rust crate clap to v4.5.50 (#21090)
  Update Rust crate get-size2 to v0.7.1 (#21091)
  Update Rust crate bstr to v1.12.1 (#21089)
  Add missing docstring sections to the numpy list (#20931)
  [`pydoclint`] Fix false positive on explicit exception re-raising (`DOC501`, `DOC502`) (#21011)
  [ty] Use constructor parameter types as type context (#21054)
dcreager added a commit that referenced this pull request Oct 28, 2025
…l-constraint-sets

* dcreager/refactor-constraint-mdtests: (60 commits)
  add static_asserts
  move all reveal diagnostics to separate line
  add more gradual tests
  better comment
  restructure a bit
  better names/comments
  simplify before implication
  two typevars!
  mdformat
  rename mdtest
  move is_subtype_of_given into ConstraintSet
  move where we grab these
  add ConstraintSet.{always,never}
  move range_constraint into ConstraintSet class
  [ty] Rename `inner` query for better debugging experience (#21106)
  [ty] Add new "constraint implication" typing relation (#21010)
  [semantic error tests]: refactor semantic error tests to separate files (#20926)
  Respect `--output-format` with `--watch` (#21097)
  [`pyflakes`] Revert to stable behavior if imports for module lie in alternate branches for `F401` (#20878)
  Fix finding keyword range for clause header after statement ending with semicolon (#21067)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to the command-line interface preview Related to preview mode features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Respect --output-format with --watch

4 participants