diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..06a8f4cf8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +# 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: + - 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