Open ZedThree opened 1 week ago
I have some performance concerns here, as checking the entire file for each import could be very costly. Would it be possible to do a first pass of the file, log which variables appear in each scope, and then reference that during the check? This would also allow us to flag unknown variables quite easily.
Yep, I was thinking something like that would allow us to do other checks too. Ruff basically does something similar for their import checking: https://docs.astral.sh/ruff/contributing/#compilation-pipeline
I think this is mostly just a case of checking
identifier
s in the current scope, but some care might be needed so we don't get any false positives.