yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sek...@apache.org
Subject yetus git commit: YETUS-219. pylint plugin displays grep error message if patch contains modification to python and other files.
Date Tue, 08 Dec 2015 02:06:36 GMT
Repository: yetus
Updated Branches:
  refs/heads/master 201a3782a -> 76653b4a2


YETUS-219. pylint plugin displays grep error message if patch contains modification to python
and other files.

Signed-off-by: Kengo Seki <sekikn@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/76653b4a
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/76653b4a
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/76653b4a

Branch: refs/heads/master
Commit: 76653b4a2e7316d774adf4f401821f4f15d3f643
Parents: 201a378
Author: Marco Zuehlke <mzuehlke@gmail.com>
Authored: Mon Dec 7 18:07:33 2015 +0100
Committer: Kengo Seki <sekikn@apache.org>
Committed: Tue Dec 8 11:04:32 2015 +0900

----------------------------------------------------------------------
 precommit/test-patch.d/pylint.sh | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/76653b4a/precommit/test-patch.d/pylint.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/pylint.sh b/precommit/test-patch.d/pylint.sh
index 7ae9454..f97a140 100755
--- a/precommit/test-patch.d/pylint.sh
+++ b/precommit/test-patch.d/pylint.sh
@@ -57,7 +57,7 @@ function pylint_preapply
 {
   local i
   local count
-  local tmp=pylint.$$.${RANDOM}
+  local pylintStderr=branch-pylint-stderr.txt
 
   verify_needed_test pylint
   if [[ $? == 0 ]]; then
@@ -79,16 +79,17 @@ function pylint_preapply
     if [[ ${i} =~ \.py$ && -f ${i} ]]; then
       # shellcheck disable=SC2086
       eval "${PYLINT} ${PYLINT_OPTIONS} --msg-template='{path}:{line}: [{msg_id}({symbol}),
{obj}] {msg}' --reports=n ${i}" \
-        2>${PATCH_DIR}/${tmp} | ${AWK} '1<NR' >> "${PATCH_DIR}/branch-pylint-result.txt"
+        2>>${PATCH_DIR}/${pylintStderr} | ${AWK} '1<NR' >> "${PATCH_DIR}/branch-pylint-result.txt"
     fi
-    # shellcheck disable=SC2016
-    count=$(${GREP} -v "^No config file found" "${PATCH_DIR}/${tmp}" | wc -l | ${AWK} '{print
$1}')
+  done
+  if [[ -f ${PATCH_DIR}/${pylintStderr} ]]; then
+    count=$(${GREP} -vc "^No config file found" "${PATCH_DIR}/${pylintStderr}")
     if [[ ${count} -gt 0 ]]; then
-      add_footer_table pylint "prepatch stderr: @@BASE@@/${tmp}"
+      add_footer_table pylint "prepatch stderr: @@BASE@@/${pylintStderr}"
       return 1
     fi
-  done
-  rm "${PATCH_DIR}/${tmp}" 2>/dev/null
+  fi
+  rm "${PATCH_DIR}/${pylintStderr}" 2>/dev/null
   popd >/dev/null
   # keep track of how much as elapsed for us already
   PYLINT_TIMER=$(stop_clock)
@@ -102,7 +103,7 @@ function pylint_postapply
   local numPrepatch
   local numPostpatch
   local diffPostpatch
-  local tmp=pylint.$$.${RANDOM}
+  local pylintStderr=patch-pylint-stderr.txt
 
   verify_needed_test pylint
   if [[ $? == 0 ]]; then
@@ -130,17 +131,18 @@ function pylint_postapply
     if [[ ${i} =~ \.py$ && -f ${i} ]]; then
       # shellcheck disable=SC2086
       eval "${PYLINT} ${PYLINT_OPTIONS} --msg-template='{path}:{line}: [{msg_id}({symbol}),
{obj}] {msg}' --reports=n ${i}" \
-        2>${PATCH_DIR}/${tmp} | ${AWK} '1<NR' >> "${PATCH_DIR}/patch-pylint-result.txt"
+        2>>${PATCH_DIR}/${pylintStderr} | ${AWK} '1<NR' >> "${PATCH_DIR}/patch-pylint-result.txt"
     fi
-    # shellcheck disable=SC2016
-    count=$(${GREP} -v "^No config file found" "${PATCH_DIR}/${tmp}" | wc -l | ${AWK} '{print
$1}')
+  done
+  if [[ -f ${PATCH_DIR}/${pylintStderr} ]]; then
+    count=$(${GREP} -vc "^No config file found" "${PATCH_DIR}/${pylintStderr}")
     if [[ ${count} -gt 0 ]]; then
       add_vote_table -1 pylint "Something bad seems to have happened in running pylint. Please
check pylint stderr files."
-      add_footer_table pylint "postpatch stderr: @@BASE@@/${tmp}"
+      add_footer_table pylint "postpatch stderr: @@BASE@@/${pylintStderr}"
       return 1
     fi
-  done
-  rm "${PATCH_DIR}/${tmp}" 2>/dev/null
+  fi
+  rm "${PATCH_DIR}/${pylintStderr}" 2>/dev/null
   popd >/dev/null
 
   # shellcheck disable=SC2016


Mime
View raw message