From 14f932b06cffdec538cf8824f6cdc522496a525f Mon Sep 17 00:00:00 2001 From: syaojun Date: Wed, 4 Mar 2026 12:07:56 +0800 Subject: [PATCH 1/2] feat: add Spotless plugin configuration for code formatting in Maven --- .pre-commit-config.yaml | 9 +++++++++ pom.xml | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..a72573935 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +repos: + - repo: local + hooks: + - id: maven-spotless-check + name: Spotless check (Maven) + entry: bash -c 'mvn -DspotlessFiles=\"$@\" spotless:check' -- + language: system + pass_filenames: true + files: "\\.java$" diff --git a/pom.xml b/pom.xml index 66d19baee..76fba71e8 100644 --- a/pom.xml +++ b/pom.xml @@ -264,6 +264,43 @@ versions-maven-plugin 2.8.1 + + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + + + src/main/java/**/*.java + src/test/java/**/*.java + + + **/generated/**/* + **/proto/**/* + + + 1.17.0 + + true + true + + + java,javax,org,com, + + + + + + + + + check + + validate + + + org.apache.maven.plugins From f3e95992aa8443349339a07681b5e0303932b730 Mon Sep 17 00:00:00 2001 From: syaojun Date: Fri, 6 Mar 2026 22:11:24 +0800 Subject: [PATCH 2/2] chore: add license in header --- .pre-commit-config.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a72573935..06a8f4cf8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# See: https://cwiki.apache.org/confluence/display/INFRA/git+-+.asf.yaml+features + repos: - repo: local hooks: