[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [clazy] /: add new --list and --explain options to clazy
From: Allen Winter <allen.winter () kdab ! com>
Date: 2016-05-30 20:40:23
Message-ID: E1b7Tz5-0007L7-DY () scm ! kde ! org
[Download RAW message or body]
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 \
${CMAKE_INSTALL_BINDIR} set(SHARE_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR} CACHE \
STRING "Share directory name")
if(NOT WIN32)
- install(FILES ${CMAKE_SOURCE_DIR}/clazy DESTINATION bin PERMISSIONS OWNER_WRITE \
OWNER_EXECUTE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE) + \
configure_file(${CMAKE_SOURCE_DIR}/clazy.cmake ${CMAKE_BINARY_DIR}/clazy @ONLY) + \
install(FILES ${CMAKE_BINARY_DIR}/clazy DESTINATION bin PERMISSIONS OWNER_WRITE \
OWNER_EXECUTE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_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=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
+sharedir=@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=`ls -1 $sharedir/doc/level*/README*$1*`
+ for f in $lst
+ do
+ l=`echo $f | awk -F/ '{foo=NF-1; printf(" %s:%s\n", $foo,$NF)}'`
+ level=`echo $l | cut -d: -f1`
+ checker=`echo $l | cut -d: -f2 | sed s/README-//`
+ echo "== Explanation for checker $checker ($level) =="
+ cat $f
+ echo
+ done
+}
+
+if ( test $# -gt 0 -a "$1" = "--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" = "--explain" )
+then
+ shift
+ PRINFO $@
+ exit
+fi
+
+${CLANGXX:-clang++} -Qunused-arguments -Xclang -load -Xclang ClangLazy.so -Xclang \
-add-plugin -Xclang clang-lazy $@
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic