This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new ea26cac89a07 [SPARK-55266][INFRA] Add pre-commit hooks for format/lint
ea26cac89a07 is described below
commit ea26cac89a07fde2f3d7eb4118ce936c121cbd60
Author: Tian Gao <[email protected]>
AuthorDate: Fri Jan 30 09:37:58 2026 +0900
[SPARK-55266][INFRA] Add pre-commit hooks for format/lint
### What changes were proposed in this pull request?
Add pre-commit yaml file to allow users optionally enable pre-commit hook.
### Why are the changes needed?
It's common that users forget to check lint/format and have to wait for 2
hours to realize it. This prevents that situation. Also python reformatter and
lint is sub-second so it won't impact user too much.
This is also optional. User won't feel it without explicitly installing
`pre-commit`
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Local pre-commit worked.
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #54048 from gaogaotiantian/pre-commit.
Authored-by: Tian Gao <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
---
.pre-commit-config.yaml | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 000000000000..daab66385885
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,33 @@
+#
+# 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.
+#
+
+repos:
+ - repo: local
+ hooks:
+ - id: format-python
+ name: Format Python code
+ entry: ./dev/reformat-python
+ language: system
+ types: [python]
+ pass_filenames: false
+
+ - id: ruff
+ name: Lint Python code with Ruff
+ entry: ./dev/lint-python --ruff
+ language: system
+ types: [python]
+ pass_filenames: false
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]