rokucommunity / bslint

A linter for BrightScript and BrighterScript.
MIT License
28 stars 15 forks source link

Warn on unused local variables #10

Closed triwav closed 3 years ago

triwav commented 4 years ago

We should have all the information needed to know if a local variable never gets used. We should have a rule that if a variable is unused it warns about it.

triwav commented 4 years ago

We should also be able to warn if you use a local variable that is never defined as well.

triwav commented 4 years ago

On second thought, we should probably just build that in the parser itself since that's no longer a lint thing but an actual crash potentionally

elsassph commented 4 years ago

I think it's a fair lint rule. It indicates a potential mistake but isn't a straight validation/crash reason - it can just be debug/dead code.

TwitchBronBron commented 4 years ago

Brian is saying that this shouldn't be a lint rule, it should be a compiler rule (built into bsc). Very similar to typescript's --noUnusedLocals and --noUnusedParameters

elsassph commented 4 years ago

You can't track that without doing the whole variables and codepaths tracking. This means moving most of what I have in this repo into the compiler.