aw-was-here commented on a change in pull request #88: YETUS-936 test-patch.sh 
does not do gradle
URL: https://github.com/apache/yetus/pull/88#discussion_r379929958
 
 

 ##########
 File path: precommit/src/main/shell/test-patch.d/checkstyle.sh
 ##########
 @@ -202,10 +217,39 @@ function checkstyle_runner
     echo_and_redirect "${logfile}" ${cmd}
     cmdresult=$?
 
-    "${SED}" -e 's,^\[ERROR\] ,,g' -e 's,^\[WARN\] ,,g' "${logfile}" \
-      | ${GREP} ^/ \
-      | ${SED} -e "s,${BASEDIR},.,g" \
-      > "${tmp}"
+    case ${BUILDTOOL} in
+      ant)
+        "${SED}" -e 's,^\[ERROR\] ,,g' -e 's,^\[WARN\] ,,g' "${logfile}" \
+          | "${GREP}" ^/ \
+          | "${SED}" -e "s,${BASEDIR},.,g" \
+          > "${tmp}"
+        ;;
+      maven)
+        "${SED}" -e 's,^\[ERROR\] ,,g' -e 's,^\[WARN\] ,,g' "${logfile}" \
+          | "${GREP}" ^/ \
+          | "${SED}" -e "s,${BASEDIR},.,g" \
+          > "${tmp}"
+          ;;
+      gradle)
+          # convert xml to maven-like output
+          while read -r line; do
+            if [[ $line =~ ^\<file ]]; then
+              fn=$(echo "$line" | "${SED}" -E 's,^.+name="([^"]+)".+$,\1,' | 
"${SED}" -e "s,${BASEDIR},.,g")
+            elif [[ $line =~ ^\<error ]]; then
+              if [[ $line =~ column ]]; then
+                newline=$(echo "$line" | "${SED}" -E 
's,^.+line="([0-9]+)".*column="([0-9]+)".*severity="([a-z]+)".*message="([^"]+)".+$,__FN__:\1\:\2:\4,')
+              else
+                newline=$(echo "$line" | "${SED}" -E 
's,^.+line="([0-9]+)".*severity="([a-z]+)".*message="([^"]+)".+$,__FN__:\1:\3,')
+              fi
+              newline=$(echo "$newline" | "${SED}" -e "s,__FN__,$fn," -e 
"s,\&apos;,\',g" -e "s,\&quot;,\",g")
+              echo "$newline" >> "${tmp}"
+            fi
+          done < <(cat "${BASEDIR}/build/reports/checkstyle/main.xml" 
"${BASEDIR}/build/reports/checkstyle/test.xml")
+          mkdir -p "${PATCH_DIR}/${repostatus}-checkstyle"
+          cp  "${BASEDIR}/build/reports/checkstyle/main.xml" 
"${BASEDIR}/build/reports/checkstyle/test.xml" "${tmp}" \
+               "${PATCH_DIR}/${repostatus}-checkstyle"
 
 Review comment:
   Woops, these two lines were supposed to be removed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to