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

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


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

commit f305a5c532d8e7693b7f14361d7b54a346a77ce6
Author: Nihal Jain <nihalj...@apache.org>
AuthorDate: Sun Jul 20 01:07:02 2025 +0530

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

diff --git a/dev/phoenix-personality.sh b/dev/phoenix-personality.sh
index 706cfb85b3..772a8eb8f3 100755
--- a/dev/phoenix-personality.sh
+++ b/dev/phoenix-personality.sh
@@ -419,3 +419,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