ruff
ruff copied to clipboard
[red knot] Introduce `LintDb`
Summary
This PR introduces a new LintDb and moves the lint_syntax and lint_semantic methods to the new trait.
The reason for splitting out a new LintDb is that I see the following crates long term (at least)
red_knot_query: Infrastructure for a query based compilerred_knot_source: Exposes the base queries to read a file and parse it.red_knot_formatter: Exposes format queries (I don't know how they will look and what we want to cache). Usesred_knot_source` so that we can re-use parse trees between lint and formatred_knot_semanticorred_knot_analysis: Contains theSemanticDbexposing the semantic model and type inference (I'm not yet sure where I would put type checking)red_knot_lint: Implements the lint queries. Is based on bothred_knot_sourceandred_knot_semantic. Idealyly, we would have a way to split lint rules into sub-crates, but I'm not yet sure how that would work.
Test Plan
cargo test
ruff-ecosystem results
Linter (stable)
✅ ecosystem check detected no linter changes.
Linter (preview)
✅ ecosystem check detected no linter changes.