[Libreoffice-commits] dev-tools.git: cppcheck/cppcheck-report.sh

mhoes hoes.maarten at gmail.com
Mon Mar 26 10:06:26 UTC 2018


 cppcheck/cppcheck-report.sh |   40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

New commits:
commit 0e5969770a4d0ce94a105599aeaffb10f1287444
Author: mhoes <hoes.maarten at gmail.com>
Date:   Thu Feb 22 18:36:11 2018 +0100

    Minor tweaks. Replace "$@" with "$*", `cmd` with $(cmd), and ~/foo with "$HOME"/foo.
    
    Change-Id: I6d32d21fdf8cbe4b734e1031335e0d5d61a62444
    Reviewed-on: https://gerrit.libreoffice.org/50194
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/cppcheck/cppcheck-report.sh b/cppcheck/cppcheck-report.sh
index 31f8360..2e6090d 100755
--- a/cppcheck/cppcheck-report.sh
+++ b/cppcheck/cppcheck-report.sh
@@ -23,7 +23,7 @@ exec 2>&1
 
 die()
 {
-    MESSAGE="$@"
+    MESSAGE="$*"
     echo "Error: ${MESSAGE?}" >&2
     mail_failure "${MESSAGE?}"
     exit -1;
@@ -119,7 +119,7 @@ A new cppcheck report is available at : http://dev-builds.libreoffice.org/cppche
 
 Note:
     The script generating this report was run at :
-        `date +%Y-%d-%m_%H:%M:%S` with user `whoami` at host `cat /etc/hostname` as $MY_NAME $MY_ARGS
+        $(date "+%Y-%d-%m %H:%M:%S") with user $(whoami) at host $(cat /etc/hostname) as $MY_NAME $MY_ARGS
 
     It can be found and improved here:
         https://gerrit.libreoffice.org/gitweb?p=dev-tools.git;a=blob;f=cppcheck/cppcheck-report.sh
@@ -133,12 +133,12 @@ EOF
 
 mail_failure()
 {
-    MESSAGE="$@"
+    MESSAGE="$*"
 
     if [ -f /tmp/cppcheck-report.log ] ; then
-        cp -f /tmp/cppcheck-report.log ~/cppcheck-report.log
-        rm -f ~/cppcheck-report.log.gz
-        gzip ~/cppcheck-report.log
+        cp -f /tmp/cppcheck-report.log "$HOME"/cppcheck-report.log
+        rm -f "$HOME"/cppcheck-report.log.gz
+        gzip "$HOME"/cppcheck-report.log
     fi
 
 cat > "$EMAIL_BODY" <<EOF
@@ -148,7 +148,7 @@ The cppcheck job failed with message: "${MESSAGE?}"
 
 Note:
     The script generating this report was run at :
-        `date +%Y-%d-%m_%H:%M:%S` with user `whoami` at host `cat /etc/hostname` as $MY_NAME $MY_ARGS
+        $(date "+%Y-%d-%m %H:%M:%S") with user $(whoami) at host $(cat /etc/hostname) as $MY_NAME $MY_ARGS
 
     It can be found and improved here:
         https://gerrit.libreoffice.org/gitweb?p=dev-tools.git;a=blob;f=cppcheck/cppcheck-report.sh
@@ -180,21 +180,21 @@ if [ "$#" = "0" ] ; then
 fi
 
 # Set some defaults here
-LO_SRC_DIR=~/source/libo-core
-HTML_DIR=~/tmp/www
-CPPCHECK_DIR=~/source/cppcheck
-DATA_DIR=~/tmp
+LO_SRC_DIR="$HOME"/source/libo-core
+HTML_DIR="$HOME"/tmp/www
+CPPCHECK_DIR="$HOME"/source/cppcheck
+DATA_DIR="$HOME"/tmp
 CPPCHECK_GIT_URL="git://github.com/danmar/cppcheck.git"
 LO_GIT_URL="git://anongit.freedesktop.org/libreoffice/core.git"
 UPLOAD_DIR=/srv/www/dev-builds.libreoffice.org/cppcheck_reports/master
 MAILTO=libreoffice at lists.freedesktop.org
 MAILFROM=cppcheck.libreoffice at gmail.com
-MY_NAME=`readlink -f $0`
-MY_ARGS=$@
+MY_NAME=$(readlink -f "$0")
+MY_ARGS="$*"
 MESSAGE=
-SENDEMAIL=~/source/buildbot/bin/sendEmail
-EMAIL_BODY=~/tmp/email_body
-# Dont forget to set SMTP_PWD in your ~/.cppcheckrc !
+SENDEMAIL="$HOME"/source/buildbot/bin/sendEmail
+EMAIL_BODY="$HOME"/tmp/email_body
+# Dont forget to set SMTP_PWD in your "$HOME"/.cppcheckrc !
 SMTP_PWD=
 export PYTHONIOENCODING=UTF-8
 
@@ -213,11 +213,11 @@ export LC_MEASUREMENT="en_US.UTF-8"
 export LC_IDENTIFICATION="en_US.UTF-8"
 export LC_ALL=en_US.UTF-8
 
-if [ -f ~/.cppcheckrc ]; then
-    # override all default vars with entries in ~/.cppcheckrc
-    source ~/.cppcheckrc
+if [ -f "$HOME"/.cppcheckrc ]; then
+    # override all default vars with entries in "$HOME"/.cppcheckrc
+    source "$HOME"/.cppcheckrc
 else
-    die "Failed to locate ~/.cppcheckrc"
+    die "Failed to locate $HOME/.cppcheckrc"
 fi
 
 


More information about the Libreoffice-commits mailing list