Join GitHub today
Sometimes a variable is both assigned and referred to, but an inspection should be able to sort the references by line position and locate an identifier that's assigned a value that's reassigned before it's used - in other words a suspiciously redundant assignment involving a value that's never used.
That one is entering the realm of execution paths: it needs to account for conditionals and only flag consecutive assignments in the same execution path.
The good news here is this is actually quite easy.
One thing to note, though, is this may have false positives in the event the value is used and assigned, such as could happen with the