mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
![]() Summary -- This is the last main difference between the `OldDiagnostic` and `Message` types, so attaching a `SourceFile` to `OldDiagnostic` should make combining the two types almost trivial. Initially I updated the remaining rules without access to a `Checker` to take a `&SourceFile` directly, but after Micha's suggestion in https://github.com/astral-sh/ruff/pull/18356#discussion_r2113281552, I updated all of these calls to take a `LintContext` instead. This new type is a thin wrapper around a `RefCell<Vec<OldDiagnostic>>` and a `SourceFile` and now has the `report_diagnostic` method returning a `DiagnosticGuard` instead of `Checker`. This allows the same `Drop`-based implementation to be used in cases without a `Checker` and also avoids a lot of intermediate allocations of `Vec<OldDiagnostic>`s. `Checker` now also contains a `LintContext`, which it defers to for its `report_diagnostic` methods, which I preserved for convenience. Test Plan -- Existing tests |
||
---|---|---|
.. | ||
ruff | ||
ruff_annotate_snippets | ||
ruff_benchmark | ||
ruff_cache | ||
ruff_db | ||
ruff_dev | ||
ruff_diagnostics | ||
ruff_formatter | ||
ruff_graph | ||
ruff_index | ||
ruff_linter | ||
ruff_macros | ||
ruff_notebook | ||
ruff_options_metadata | ||
ruff_python_ast | ||
ruff_python_ast_integration_tests | ||
ruff_python_codegen | ||
ruff_python_formatter | ||
ruff_python_index | ||
ruff_python_literal | ||
ruff_python_parser | ||
ruff_python_resolver | ||
ruff_python_semantic | ||
ruff_python_stdlib | ||
ruff_python_trivia | ||
ruff_python_trivia_integration_tests | ||
ruff_server | ||
ruff_source_file | ||
ruff_text_size | ||
ruff_wasm | ||
ruff_workspace | ||
ty | ||
ty_ide | ||
ty_project | ||
ty_python_semantic | ||
ty_server | ||
ty_test | ||
ty_vendored | ||
ty_wasm |