ruff/crates
Vivek Dasari 5508e8e528
Add testing helper to compare stable vs preview snapshots (#19715)
## Summary
This PR implements a diff test helper `assert_diagnostics_diff` as
described in #19351. The diff file includes both the settings ( e.g.
`+linter.preview = enabled`) and the snapshot data itself.

The current implementation looks for each old diagnostic in the new
snapshot. This works when the preview behavior adds/removes a couple
diagnostics. This implementation does not work well when every
diagnostic is modified (e.g. a "fix" is added).
https://github.com/astral-sh/ruff/pull/19715#discussion_r2259410763 has
ideas for future improvements to this implementation.

The example usage in this PR writes the diff to `preview_diff` file
instead of `preview` file, which might be a useful convention to keep.


## Test Plan
- Included a unit test at:
https://github.com/astral-sh/ruff/pull/19715/files#diff-d49487fe3e8a8585529f62c2df2a2b0a4c44267a1f93d1e859dff1d9f8771d36R523
- Example usage of this new test helper:
https://github.com/astral-sh/ruff/pull/19715/files#diff-2a33ac11146d1794c01a29549a6041d3af6fb6f9b423a31ade12a88d1951b0c2R1
2025-08-22 12:49:34 -05:00
..
ruff Bump 0.12.10 (#20025) 2025-08-21 13:09:31 -05:00
ruff_annotate_snippets Move full diagnostic rendering to ruff_db (#19415) 2025-08-08 12:56:23 -04:00
ruff_benchmark Feature/build riscv64 bin (#19819) 2025-08-14 16:11:14 +02:00
ruff_cache
ruff_db Move diff rendering to ruff_db (#20006) 2025-08-21 09:47:00 -04:00
ruff_dev Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
ruff_diagnostics Fix rust feature activation (#20012) 2025-08-21 09:26:06 +02:00
ruff_formatter Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
ruff_graph [ty] Remove KnownModule::is_enum (#19681) 2025-08-01 10:31:12 +02:00
ruff_index
ruff_linter Add testing helper to compare stable vs preview snapshots (#19715) 2025-08-22 12:49:34 -05:00
ruff_macros Don't cache files with diagnostics (#19869) 2025-08-12 15:28:44 -04:00
ruff_memory_usage [ty] Track heap usage of salsa structs (#19790) 2025-08-12 13:28:44 +02:00
ruff_notebook
ruff_options_metadata Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
ruff_python_ast [ruff] Handle empty t-strings in unnecessary-empty-iterable-within-deque-call (RUF037) (#20045) 2025-08-22 10:23:49 -05:00
ruff_python_ast_integration_tests Disallow implicit concatenation of t-strings and other string types (#19485) 2025-07-27 12:41:03 +00:00
ruff_python_codegen Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
ruff_python_formatter Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
ruff_python_index
ruff_python_literal
ruff_python_parser Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
ruff_python_semantic Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
ruff_python_stdlib
ruff_python_trivia
ruff_python_trivia_integration_tests
ruff_server Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
ruff_source_file Move diff rendering to ruff_db (#20006) 2025-08-21 09:47:00 -04:00
ruff_text_size [ty] Fix a few more diagnostic differences from Ruff (#19806) 2025-08-08 11:31:19 -04:00
ruff_wasm Bump 0.12.10 (#20025) 2025-08-21 13:09:31 -05:00
ruff_workspace Fix rust feature activation (#20012) 2025-08-21 09:26:06 +02:00
ty [ty] distinguish base conda from child conda (#19990) 2025-08-20 09:07:42 -04:00
ty_combine [ty] Support LSP client settings (#19614) 2025-08-06 18:37:21 +05:30
ty_ide Fix incorrect lsp inlay hint type (#20044) 2025-08-22 17:12:49 +02:00
ty_project Fix rust feature activation (#20012) 2025-08-21 09:26:06 +02:00
ty_python_semantic [ty] rename BareTypeAliasType to ManualPEP695TypeAliasType (#20037) 2025-08-22 07:40:29 -07:00
ty_server [ty] Add type as detail to completion items (#20047) 2025-08-22 12:32:53 -04:00
ty_static [ty] distinguish base conda from child conda (#19990) 2025-08-20 09:07:42 -04:00
ty_test [ty] Stop running every mdtest twice 2025-08-21 13:37:08 -04:00
ty_vendored [ty] Sync vendored typeshed stubs (#20031) 2025-08-21 21:32:48 +00:00
ty_wasm [ty] Add type as detail to completion items (#20047) 2025-08-22 12:32:53 -04:00