ruff/crates
Brent Westbrook b5c5f710fc
Render Azure, JSON, and JSON lines output with the new diagnostics (#19133)
## Summary

This was originally stacked on #19129, but some of the changes I made
for JSON also impacted the Azure format, so I went ahead and combined
them. The main changes here are:

- Implementing `FileResolver` for Ruff's `EmitterContext`
- Adding `FileResolver::notebook_index` and `FileResolver::is_notebook`
methods
- Adding a `DisplayDiagnostics` (with an "s") type for rendering a group
of diagnostics at once
- Adding `Azure`, `Json`, and `JsonLines` as new `DiagnosticFormat`s

I tried a couple of alternatives to the `FileResolver::notebook` methods
like passing down the `NotebookIndex` separately and trying to reparse a
`Notebook` from Ruff's `SourceFile`. The latter seemed promising, but
the `SourceFile` only stores the concatenated plain text of the
notebook, not the re-parsable JSON. I guess the current version is just
a variation on passing the `NotebookIndex`, but at least we can reuse
the existing `resolver` argument. I think a lot of this can be cleaned
up once Ruff has its own actual file resolver.

As suggested, I also tried deleting the corresponding `Emitter` files in
`ruff_linter`, but it doesn't look like git was able to follow this as a
rename. It did, however, track that the tests were moved, so the
snapshots should be easy to review.

## Test Plan

Existing Ruff tests ported to tests in `ruff_db`. I think some other
existing ruff tests also cover parts of this refactor.

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2025-07-11 15:04:46 -04:00
..
ruff Render Azure, JSON, and JSON lines output with the new diagnostics (#19133) 2025-07-11 15:04:46 -04:00
ruff_annotate_snippets Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011) 2025-06-28 20:24:00 +02:00
ruff_benchmark [ty] Re-enable multithreaded pydantic benchmark (#19176) 2025-07-07 14:28:15 +02:00
ruff_cache Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_db Render Azure, JSON, and JSON lines output with the new diagnostics (#19133) 2025-07-11 15:04:46 -04:00
ruff_dev Auto-generate environment variable references for ty (#19205) 2025-07-08 10:48:31 -04:00
ruff_diagnostics Combine `OldDiagnostic` and `Diagnostic` (#19053) 2025-07-03 13:01:09 -04:00
ruff_formatter Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_graph Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011) 2025-06-28 20:24:00 +02:00
ruff_index Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011) 2025-06-28 20:24:00 +02:00
ruff_linter Render Azure, JSON, and JSON lines output with the new diagnostics (#19133) 2025-07-11 15:04:46 -04:00
ruff_macros [ty] Merge `ty_macros` into `ruff_macros` (#19229) 2025-07-09 11:28:21 +00:00
ruff_notebook Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_options_metadata [ty] Document configuration schema (#17950) 2025-05-09 10:47:45 +02:00
ruff_python_ast Make dependency `get-size2` truly optional in `ruff_python_ast` (#19052) 2025-06-30 21:50:59 -05:00
ruff_python_ast_integration_tests [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
ruff_python_codegen Fix f-string interpolation escaping (#18882) 2025-06-25 10:04:15 +02:00
ruff_python_formatter Update pre-commit dependencies (#19162) 2025-07-07 04:07:44 +00:00
ruff_python_index Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_literal Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_parser [ty] add support for `nonlocal` statements 2025-07-11 09:44:54 -07:00
ruff_python_semantic [`flake8-return`] Fix false-positive for variables used inside nested functions in `RET504` (#18433) 2025-07-10 16:10:22 -04:00
ruff_python_stdlib Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_trivia Treat `ty: ` comments as pragma comments (#18532) 2025-06-07 16:02:43 +02:00
ruff_python_trivia_integration_tests Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_server Render Azure, JSON, and JSON lines output with the new diagnostics (#19133) 2025-07-11 15:04:46 -04:00
ruff_source_file [ty] Add environment variable to dump Salsa memory usage stats (#18928) 2025-06-26 21:27:51 +00:00
ruff_text_size [ty] Add environment variable to dump Salsa memory usage stats (#18928) 2025-06-26 21:27:51 +00:00
ruff_wasm Bump 0.12.3 (#19279) 2025-07-11 09:07:50 -04:00
ruff_workspace Fix description of the `format.skip-magic-trailing-comma` example (#19095) 2025-07-03 10:39:59 -04:00
ty Render Azure, JSON, and JSON lines output with the new diagnostics (#19133) 2025-07-11 15:04:46 -04:00
ty_ide [ty] Add completions for submodule imports 2025-07-11 10:06:35 -04:00
ty_project Render Azure, JSON, and JSON lines output with the new diagnostics (#19133) 2025-07-11 15:04:46 -04:00
ty_python_semantic [ty] add support for `nonlocal` statements 2025-07-11 09:44:54 -07:00
ty_server [ty] Make sure to always respond to client requests (#19277) 2025-07-11 14:27:27 +00:00
ty_static [ty] Merge `ty_macros` into `ruff_macros` (#19229) 2025-07-09 11:28:21 +00:00
ty_test [ty] Make `check_file` a salsa query (#19255) 2025-07-10 18:46:56 +05:30
ty_vendored [ty] Sync vendored typeshed stubs (#19174) 2025-07-07 12:00:09 +02:00
ty_wasm [ty] Add signature help provider to playground (#19276) 2025-07-11 09:58:14 +02:00