PlasmaFAIR / fortitude

A Fortran linter, written in Rust and installable with Python.
MIT License
42 stars 1 forks source link

Unused imports, arguments, variables #133

Open ZedThree opened 1 week ago

ZedThree commented 1 week ago

I think this is mostly just a case of checking identifiers in the current scope, but some care might be needed so we don't get any false positives.

LiamPattinson commented 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.

ZedThree commented 1 week ago

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