Bug 388979 - Allow to add classes to UnusedNonTrivialVariable::isInterestingType
Summary: Allow to add classes to UnusedNonTrivialVariable::isInterestingType
Status: RESOLVED FIXED
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-01-14 22:27 UTC by Albert Astals Cid
Modified: 2018-01-15 23:06 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Astals Cid 2018-01-14 22:27:34 UTC
Some projects may have their own classes that they may want to lookout in the "declared but not used" scenario, i.e. for poppler i did a run with Object and found quite a few.

I guess easier would be an environment variable?
Comment 1 Sergio Martins 2018-01-15 22:42:50 UTC
Git commit e847520dcf734c384aa6607317133faa1d73eb86 by Sergio Martins.
Committed on 15/01/2018 at 22:42.
Pushed by smartins into branch 'master'.

unused-non-trivial-variable: Add option to disable the whitelist

Meaning it will warn for any unused non-trivial variable. This will
cause false-positives, such as RAII types, but still useful to run at least once
on your code.

Do use it:
export CLAZY_EXTRA_OPTIONS=unused-non-trivial-variable-no-whitelist

Next will implement blacklist/whitelist support from env-variable

M  +4    -0    src/checks/level0/README-unused-non-trivial-variable.md
M  +31   -0    src/checks/level0/unused-non-trivial-variable.cpp
M  +1    -0    src/checks/level0/unused-non-trivial-variable.h
M  +4    -0    tests/unused-non-trivial-variable/config.json
A  +62   -0    tests/unused-non-trivial-variable/no-whitelist.cpp     [License: UNKNOWN]  *
A  +7    -0    tests/unused-non-trivial-variable/no-whitelist.cpp.expected

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://commits.kde.org/clazy/e847520dcf734c384aa6607317133faa1d73eb86
Comment 2 Sergio Martins 2018-01-15 23:06:52 UTC
Git commit 3e2edaa8f7048b25f6a2b501c794043409eff524 by Sergio Martins.
Committed on 15/01/2018 at 23:03.
Pushed by smartins into branch 'master'.

unused-non-trivial-variable: Add user blacklist and whitelist

You can now use CLAZY_UNUSED_NON_TRIVIAL_VARIABLE_WHITELIST to
set a comma separated list of user types which you want to warn on.

Conversly, if you disabled the whitelist via export CLAZY_EXTRA_OPTIONS=unused-non-trivial-variable-no-whitelist
then you'll want a blacklist, that's the env variable CLAZY_UNUSED_NON_TRIVIAL_VARIABLE_BLACKLIST, which also
accepts comma separated list.

M  +5    -1    src/checks/level0/README-unused-non-trivial-variable.md
M  +25   -1    src/checks/level0/unused-non-trivial-variable.cpp
M  +2    -0    src/checks/level0/unused-non-trivial-variable.h
M  +5    -2    tests/unused-non-trivial-variable/config.json
M  +12   -1    tests/unused-non-trivial-variable/main.cpp
M  +1    -0    tests/unused-non-trivial-variable/main.cpp.expected
M  +11   -0    tests/unused-non-trivial-variable/no-whitelist.cpp

https://commits.kde.org/clazy/3e2edaa8f7048b25f6a2b501c794043409eff524