Git commit 729af7d84607b7af0dd00dfcc7fbeb6f01ba8eff by Allen Winter. Committed on 30/05/2016 at 20:40. Pushed by winterz into branch 'master'. add new --list and --explain options to clazy REVIEW: 128050 M +2 -1 CMakeLists.txt D +0 -3 clazy A +45 -0 clazy.cmake http://commits.kde.org/clazy/729af7d84607b7af0dd00dfcc7fbeb6f01ba8eff diff --git a/CMakeLists.txt b/CMakeLists.txt index a7caa96..ea752ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,7 +196,8 @@ install(TARGETS ClangLazy RUNTIME DESTINATION ${CMA= KE_INSTALL_BINDIR} set(SHARE_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR} CACHE STRING "Share dir= ectory name") = if(NOT WIN32) - install(FILES ${CMAKE_SOURCE_DIR}/clazy DESTINATION bin PERMISSIONS OW= NER_WRITE OWNER_EXECUTE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORL= D_EXECUTE) + configure_file(${CMAKE_SOURCE_DIR}/clazy.cmake ${CMAKE_BINARY_DIR}/cla= zy @ONLY) + install(FILES ${CMAKE_BINARY_DIR}/clazy DESTINATION bin PERMISSIONS OW= NER_WRITE OWNER_EXECUTE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORL= D_EXECUTE) else() if(MSVC) set(CLANG_COMPILER "clang-cl") diff --git a/clazy b/clazy deleted file mode 100755 index a950f79..0000000 --- a/clazy +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -${CLANGXX:-clang++} -Qunused-arguments -Xclang -load -Xclang ClangLazy.so = -Xclang -add-plugin -Xclang clang-lazy $@ diff --git a/clazy.cmake b/clazy.cmake new file mode 100644 index 0000000..33a8bb9 --- /dev/null +++ b/clazy.cmake @@ -0,0 +1,45 @@ +#!/usr/bin/env sh + +#TODO help command line option +#TODO version command line option + +libdir=3D@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ +sharedir=3D@CMAKE_INSTALL_PREFIX@/@SHARE_INSTALL_DIR@/clazy + +PRLIST() { + echo "" + echo "Checks from level$1. $2:" + ls -1 $sharedir/doc/level$1/README* | awk -F/ '{printf(" %s\n", $NF)}= ' | sed s/README-// | sort +} + +PRINFO() { + lst=3D`ls -1 $sharedir/doc/level*/README*$1*` + for f in $lst + do + l=3D`echo $f | awk -F/ '{foo=3DNF-1; printf(" %s:%s\n", $foo,$N= F)}'` + level=3D`echo $l | cut -d: -f1` + checker=3D`echo $l | cut -d: -f2 | sed s/README-//` + echo "=3D=3D Explanation for checker $checker ($level) =3D=3D" + cat $f + echo + done +} + +if ( test $# -gt 0 -a "$1" =3D "--list" ) +then + echo "List of available clazy checkers:" + PRLIST 0 "Very stable checks, 100% safe, no false-positives" + PRLIST 1 "Mostly stable and safe, rare false-positives" + PRLIST 2 "Sometimes has false-positives (20-30%)" + PRLIST 3 "Not always correct, high rate of false-positives" + exit +fi + +if ( test $# -gt 0 -a "$1" =3D "--explain" ) +then + shift + PRINFO $@ + exit +fi + +${CLANGXX:-clang++} -Qunused-arguments -Xclang -load -Xclang ClangLazy.so = -Xclang -add-plugin -Xclang clang-lazy $@