Bug 397885 - clazy-standalone: option to exclude subdirs
Summary: clazy-standalone: option to exclude subdirs
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-08-26 11:59 UTC by Friedrich W. H. Kossebau
Modified: 2018-09-08 17:18 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 Friedrich W. H. Kossebau 2018-08-26 11:59:10 UTC
Given a software project which has (for whatever reason) some copies of 3rd-party code in some subdirs. Such 3rd-party code copies often should stay untouched from optimizations, to keep the diff to the original code as small as possible.

So it would be useful to be able to exclude those subdirs from clazy runs, to both not spend time on code which should not be changed as well as keep the result lists clean from uninteresting results (and fixes).

Possibly could be done by adding a new comand line flag (--ignore-dirs= or with a better name) which would take a list of either absolute paths or subdir name patterns/wildcards.
Another option would be config files (.clazy?) to control that behaviour

Being able to overrule any config files via the command line though would be good to have, e.g. when running clazy from a UI program or some tooling with a separate config system.


Example:
KDevelop codebase which has some copies of subversion code, astyle code and qtcreator's qml parsing code. Those copies are in their own special subdirectories  (all named 3rdparty/) and should be often ignored when running clazy-standalone on the whole project, like with performance checks.

So something like
clazy-standalone --ignore-dirs=3rdparty -p /path/to/kdevelop/builddir /path/to/kdevelop/sources -checks=check1,check2
would improve user experience.
Comment 1 Sergio Martins 2018-09-08 17:18:20 UTC
Git commit 925a3b596920db23bd4ddde256959baf9fbd8e30 by Sergio Martins.
Committed on 08/09/2018 at 17:16.
Pushed by smartins into branch 'master'.

Add ability to ignore directories via command line

For ClazyStandalone it's with --ignore-dirs.
For clazy it's via the CLAZY_IGNORE_DIRS env variable.

Both take a regexp, to make it similar to clang-tidy.

M  +1    -0    Changelog
M  +10   -9    src/Clazy.cpp
M  +2    -0    src/Clazy.h
M  +4    -1    src/ClazyContext.cpp
M  +31   -5    src/ClazyContext.h
M  +5    -1    src/ClazyStandaloneMain.cpp
M  +1    -1    src/checkbase.cpp
M  +15   -0    tests/clazy-standalone/config.json
A  +7    -0    tests/clazy-standalone/fileToIgnore.cpp     [License: UNKNOWN]  *
A  +2    -0    tests/clazy-standalone/fileToIgnore.cpp.expected
A  +6    -0    tests/clazy-standalone/fileToNotIgnore.cpp     [License: UNKNOWN]  *
A  +1    -0    tests/clazy-standalone/fileToNotIgnore.cpp.expected
M  +6    -1    tests/run_tests.py

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/925a3b596920db23bd4ddde256959baf9fbd8e30
Comment 2 Sergio Martins 2018-09-08 17:18:25 UTC
Git commit 925a3b596920db23bd4ddde256959baf9fbd8e30 by Sergio Martins.
Committed on 08/09/2018 at 17:16.
Pushed by smartins into branch 'master'.

Add ability to ignore directories via command line

For ClazyStandalone it's with --ignore-dirs.
For clazy it's via the CLAZY_IGNORE_DIRS env variable.

Both take a regexp, to make it similar to clang-tidy.

M  +1    -0    Changelog
M  +10   -9    src/Clazy.cpp
M  +2    -0    src/Clazy.h
M  +4    -1    src/ClazyContext.cpp
M  +31   -5    src/ClazyContext.h
M  +5    -1    src/ClazyStandaloneMain.cpp
M  +1    -1    src/checkbase.cpp
M  +15   -0    tests/clazy-standalone/config.json
A  +7    -0    tests/clazy-standalone/fileToIgnore.cpp     [License: UNKNOWN]  *
A  +2    -0    tests/clazy-standalone/fileToIgnore.cpp.expected
A  +6    -0    tests/clazy-standalone/fileToNotIgnore.cpp     [License: UNKNOWN]  *
A  +1    -0    tests/clazy-standalone/fileToNotIgnore.cpp.expected
M  +6    -1    tests/run_tests.py

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/925a3b596920db23bd4ddde256959baf9fbd8e30