Bug 400504 - Add new checker that warns about variables declared that are only used inside one of the branches on an if
Summary: Add new checker that warns about variables declared that are only used inside...
Status: REPORTED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-31 08:21 UTC by Albert Astals Cid
Modified: 2018-10-31 09:32 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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