ruff
242df67c - Move lint rules out of `checkers/ast/mod.rs` (#5957)

Commit
2 years ago
Move lint rules out of `checkers/ast/mod.rs` (#5957) ## Summary This PR attempts to draw some basic separation between the `Checker`'s traversal responsibilities (traversing the AST, building the semantic model) and its calling-out-to-lint-rule responsibilities. It doesn't try to introduce any sophisticated API. Instead, it just moves all of the lint rule calls out of `checkers/ast/mod.rs` and into methods in a new `analyze` module. (There are four remaining lint rules in `Checker`, but I'll remove those in future PRs.) I'm not trying to "solve" our lint rule API here. Instead, I'm trying to make two improvements: 1. `checkers/ast/mod.rs` has just gotten way too large, and people work in it all the time. Prior to this PR, it was 5.5k lines, which led to significant lags in my editor and made it really hard to reason about the parts that are _actually_ important. (I like big files, but this one crossed the line for me.) Now, it's < 2,000 lines, and the code is much more focused. 2. I want to avoid accidentally adding lint rules in the "wrong" parts of the traversal. By confining lint rule invocations to these "analyze" calls, we'll avoid (e.g.) putting them in the binding phase.
Author
Parents
Loading