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

nihaljain pushed a commit to branch 5.1
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/5.1 by this push:
     new e48e2c7abb PHOENIX-7443 Add Spotless to the pre-commit checks (#2119) 
(#2261)
e48e2c7abb is described below

commit e48e2c7abbfc2e1f321a01b2df3d4f0dc56d9775
Author: Nihal Jain <[email protected]>
AuthorDate: Wed Aug 6 14:31:08 2025 +0530

    PHOENIX-7443 Add Spotless to the pre-commit checks (#2119) (#2261)
---
 dev/phoenix-personality.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/dev/phoenix-personality.sh b/dev/phoenix-personality.sh
index 7c3b360de6..4171141b24 100755
--- a/dev/phoenix-personality.sh
+++ b/dev/phoenix-personality.sh
@@ -416,3 +416,54 @@ function hbase_javac_logfilter
 
   ${GREP} -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" | sort > "${output}"
 }
+
+######################################
+# Below plugin is copied from 
https://github.com/apache/hbase/blob/master/dev-support/hbase-personality.sh
+######################################
+
+add_test_type spotless
+
+## @description  spotless file filter
+## @audience     private
+## @stability    evolving
+## @param        filename
+function spotless_filefilter
+{
+  # always add spotless check as it can format almost all types of files
+  add_test spotless
+}
+## @description run spotless:check to check format issues
+## @audience private
+## @stability evolving
+## @param repostatus
+function spotless_rebuild
+{
+  local repostatus=$1
+  local logfile="${PATCH_DIR}/${repostatus}-spotless.txt"
+
+  if ! verify_needed_test spotless; then
+    return 0
+  fi
+
+  big_console_header "Checking spotless on ${repostatus}"
+
+  start_clock
+
+  local -a maven_args=('spotless:check')
+
+  # disabled because "maven_executor" needs to return both command and args
+  # shellcheck disable=2046
+  echo_and_redirect "${logfile}" $(maven_executor) "${maven_args[@]}"
+
+  count=$(${GREP} -c '\[ERROR\]' "${logfile}")
+  if [[ ${count} -gt 0 ]]; then
+    add_vote_table -1 spotless "${repostatus} has ${count} errors when running 
spotless:check, run spotless:apply to fix."
+    add_footer_table spotless "@@BASE@@/${repostatus}-spotless.txt"
+    return 1
+  fi
+
+  add_vote_table +1 spotless "${repostatus} has no errors when running 
spotless:check."
+  return 0
+}
+
+######################################

Reply via email to