ruff icon indicating copy to clipboard operation
ruff copied to clipboard

[red knot] Introduce `LintDb`

Open MichaReiser opened this issue 1 year ago • 1 comments

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 compiler
  • red_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). Uses red_knot_source` so that we can re-use parse trees between lint and format
  • red_knot_semantic or red_knot_analysis: Contains the SemanticDb exposing 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 both red_knot_source and red_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

MichaReiser avatar Apr 29 '24 13:04 MichaReiser

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

github-actions[bot] avatar Apr 29 '24 14:04 github-actions[bot]