Bug 400504

Summary: Add new checker that warns about variables declared that are only used inside one of the branches on an if
Product: [Developer tools] clazy Reporter: Albert Astals Cid <aacid>
Component: generalAssignee: Sergio Martins <smartins>
Status: REPORTED ---    
Severity: wishlist CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Albert Astals Cid 2018-10-31 08:21:00 UTC
It would need to be whitelist based like unused-non-trivial-variable

I would like a test that warns you if you have stuff like

QFileInfo obj;
if (bla) {
    // use obj
} else {
    // don't use obj
}

And tell you to move the obj declaration inside the first if block