This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/main by this push:
     new 6d99b25  YETUS-980. jshint doesn't honor excludes file (#153)
6d99b25 is described below

commit 6d99b2547426f0c4024272a3d25e262b57dd30e0
Author: Allen Wittenauer <[email protected]>
AuthorDate: Sat Oct 10 09:05:52 2020 -0700

    YETUS-980. jshint doesn't honor excludes file (#153)
---
 precommit/src/main/shell/test-patch.d/jshint.sh | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/precommit/src/main/shell/test-patch.d/jshint.sh 
b/precommit/src/main/shell/test-patch.d/jshint.sh
index f7a8a5a..bb0dbd2 100755
--- a/precommit/src/main/shell/test-patch.d/jshint.sh
+++ b/precommit/src/main/shell/test-patch.d/jshint.sh
@@ -94,25 +94,23 @@ EOF
 function jshint_logic
 {
   declare repostatus=$1
-  declare -i count
+  declare j
+  declare full="${PATCH_DIR}/${repostatus}-jshint-result.full.txt"
+  declare filter="${PATCH_DIR}/${repostatus}-jshint-result.txt"
 
   pushd "${BASEDIR}" >/dev/null || return 1
   "${JSHINT}" \
     --extract=auto \
     --reporter="${PATCH_DIR}/jshintreporter.js" \
     . \
-    > "${PATCH_DIR}/${repostatus}-jshint-result.full.txt"
-
-  # strip the last two lines
-  #shellcheck disable=SC2016
-  count=$(wc -l "${PATCH_DIR}/${repostatus}-jshint-result.full.txt" | "${AWK}" 
'{print $1}')
-  ((count=count-2))
-  if [[ "${count}" -gt 0 ]]; then
-    head "-${count}" "${PATCH_DIR}/${repostatus}-jshint-result.full.txt"\
-      > "${PATCH_DIR}/${repostatus}-jshint-result.txt"
-  else
-    touch "${PATCH_DIR}/${repostatus}-jshint-result.txt"
-  fi
+    > "${full}"
+
+  # pull out the files we care about
+  for j in "${CHANGED_FILES[@]}"; do
+    "${GREP}" "^${j}:" "${full}" \
+      >> "${filter}"
+  done
+
   popd > /dev/null || return 1
 }
 

Reply via email to