Skip to content

Comments

Remove TextEmitter#20595

Merged
ntBre merged 13 commits intomainfrom
brent/remove-text-emitter
Sep 29, 2025
Merged

Remove TextEmitter#20595
ntBre merged 13 commits intomainfrom
brent/remove-text-emitter

Conversation

@ntBre
Copy link
Contributor

@ntBre ntBre commented Sep 26, 2025

Summary

Addresses #20443 (comment) by factoring out the match on the ruff output format in a way that should be reusable by the formatter.

I didn't think this was going to work at first, but the fact that the config holds options that apply only to certain output formats works in our favor here. We can set up a single config for all of the output formats and then use try_from to convert the OutputFormat to a DiagnosticFormat later.

Test Plan

Existing tests, plus a few new ones to make sure relocating the SHOW_FIX_SUMMARY rendering worked, that was untested before. I deleted a bunch of test code along with the text module, but I believe all of it is now well-covered by the full and concise tests in ruff_db.

I also merged this branch into #20443 locally and made sure that the API actually helps. render_diagnostics dropped in perfectly and passed the tests there too.

@ntBre ntBre added the internal An internal refactor or improvement label Sep 26, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 26, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

this was otherwise untested; deleting the code that produced the summary didn't
cause anything to fail
note that I removed the `show_fix_status` setting because these errors don't
have fixes, so it doesn't change the snapshots
I'm always a bit wary of deleting tests, but I believe these are well-covered by
the tests in `full.rs` and `concise.rs` in `ruff_db`. Similarly, the helper for
generating notebook diagnostics has been adapted to `ruff_db` too.
we conver to an Applicability anyway, so it's a bit easier to do it up front,
like we do for the other output formats
since these names were already taken, I moved the setters to `with_*`

this allows fetching the values when setting up the GroupedEmitter even though
it doesn't use the rest of the rendering infrastructure
@ntBre ntBre force-pushed the brent/remove-text-emitter branch from 3c2f9d2 to 393803a Compare September 26, 2025 16:39
@ntBre ntBre marked this pull request as ready for review September 26, 2025 16:54
@ntBre ntBre merged commit 00c8851 into main Sep 29, 2025
36 checks passed
@ntBre ntBre deleted the brent/remove-text-emitter branch September 29, 2025 12:46
dcreager added a commit that referenced this pull request Sep 30, 2025
* main: (21 commits)
  [ty] Literal promotion refactor (#20646)
  [ty] Add tests for nested generic functions (#20631)
  [`cli`] Add conflict between `--add-noqa` and `--diff` options (#20642)
  [ty] Ensure first-party search paths always appear in a sensible order (#20629)
  [ty] Use `typing.Self` for the first parameter of instance methods (#20517)
  [ty] Remove unnecessary `parsed_module()` calls (#20630)
  Remove `TextEmitter` (#20595)
  [ty] Use fully qualified names to distinguish ambiguous protocols in diagnostics (#20627)
  [ty] Ecosystem analyzer: relax timeout thresholds (#20626)
  [ty] Apply type mappings to functions eagerly (#20596)
  [ty] Improve disambiguation of class names in diagnostics (#20603)
  Add the *The Basics* title back to CONTRIBUTING.md (#20624)
  [`playground`] Fix quick fixes for empty ranges in playground (#20599)
  Update dependency ruff to v0.13.2 (#20622)
  [`ruff`] Fix minor typos in doc comments (#20623)
  Update dependency PyYAML to v6.0.3 (#20621)
  Update cargo-bins/cargo-binstall action to v1.15.6 (#20620)
  Fixed documentation for try_consider_else (#20587)
  [ty] Use `Top` materializations for `TypeIs` special form (#20591)
  [ty] Simplify `Any | (Any & T)` to `Any` (#20593)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants