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

ritesh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new fdf8b6a93b HDDS-9885. Checkstyle check passing despite config error 
(#5755)
fdf8b6a93b is described below

commit fdf8b6a93b7d7d0e93349c7632e07848dcd69f22
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Wed Dec 20 02:56:34 2023 +0100

    HDDS-9885. Checkstyle check passing despite config error (#5755)
---
 hadoop-ozone/dev-support/checks/checkstyle.sh | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/hadoop-ozone/dev-support/checks/checkstyle.sh 
b/hadoop-ozone/dev-support/checks/checkstyle.sh
index 97ddfa698d..cb8b6f8f91 100755
--- a/hadoop-ozone/dev-support/checks/checkstyle.sh
+++ b/hadoop-ozone/dev-support/checks/checkstyle.sh
@@ -30,13 +30,14 @@ declare -i rc
 mvn ${MAVEN_OPTIONS} checkstyle:check > "${REPORT_DIR}/output.log"
 rc=$?
 if [[ ${rc} -ne 0 ]]; then
-  mvn ${MAVEN_OPTIONS} clean test-compile checkstyle:check
+  mvn ${MAVEN_OPTIONS} clean test-compile checkstyle:check > output.log
   rc=$?
   mkdir -p "$REPORT_DIR" # removed by mvn clean
-else
-  cat "${REPORT_DIR}/output.log"
+  mv output.log "${REPORT_DIR}"/
 fi
 
+cat "${REPORT_DIR}/output.log"
+
 #Print out the exact violations with parsing XML results with sed
 find "." -name checkstyle-errors.xml -print0 \
   | xargs -0 sed '$!N; /<file.*\n<\/file/d;P;D' \
@@ -52,6 +53,11 @@ find "." -name checkstyle-errors.xml -print0 \
       -e "s/&gt;/>/g" \
   | tee "$REPORT_FILE"
 
+# check if Maven failed due to some error other than checkstyle violation
+if [[ ${rc} -ne 0 ]] && [[ ! -s "${REPORT_FILE}" ]]; then
+  grep -m1 -F '[ERROR]' "${REPORT_DIR}/output.log" > "${REPORT_FILE}"
+fi
+
 ## generate counter
 grep -c ':' "$REPORT_FILE" > "$REPORT_DIR/failures"
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to