summaryrefslogtreecommitdiffstats
path: root/.pre-commit-config.yaml
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2024-01-09 14:47:16 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-02-26 14:57:53 +0100
commit20c563de40923d3333301ca8ed1f3f213a67ea17 (patch)
tree9da6a86399de77c74aba91e3d48b408b0a8516c2 /.pre-commit-config.yaml
parentbb6b06c81343073f10cbbd2af515cf0dac1e6549 (diff)
downloadredot-engine-20c563de40923d3333301ca8ed1f3f213a67ea17.tar.gz
Replace hand-written pre-commit hooks with `pre-commit` Python tool
`pre-commit` can be installed with pip, and configured in the Godot repo with `pre-commit install`. It can then easily be run both locally with `pre-commit run`, and on CI, in a cross-platform way. This makes it much easier for contributors to set up pre-commit hooks, without having to manually copy files to their git folder. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Diffstat (limited to '.pre-commit-config.yaml')
-rw-r--r--.pre-commit-config.yaml49
1 files changed, 49 insertions, 0 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000000..3493219ea7
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,49 @@
+repos:
+ - repo: https://github.com/pre-commit/mirrors-clang-format
+ rev: v16.0.6
+ hooks:
+ - id: clang-format
+ files: \.(c|h|cpp|hpp|cc|cxx|m|mm|inc|java|glsl)$
+ types_or: [text]
+ exclude: |
+ (?x)^(
+ tests/python_build.*|
+ .*thirdparty.*|
+ .*platform/android/java/lib/src/com.*|
+ .*-so_wrap.*
+ )
+
+ - repo: https://github.com/psf/black-pre-commit-mirror
+ rev: 23.3.0
+ hooks:
+ - id: black
+ files: (\.py$|SConstruct|SCsub)
+ types_or: [text]
+ exclude: .*thirdparty.*
+ args:
+ - --line-length=120
+
+ - repo: local
+ hooks:
+ - id: make-rst
+ name: make-rst
+ entry: python3 doc/tools/make_rst.py doc/classes modules platform --dry-run --color
+ pass_filenames: false
+ language: python
+ files: ^(doc|modules|platform).*xml$
+
+ - id: copyright-headers
+ name: copyright-headers
+ language: python
+ files: \.(c|h|cpp|hpp|cc|cxx|m|mm|inc|java)$
+ entry: python3 misc/scripts/copyright_headers.py
+ exclude: |
+ (?x)^(
+ tests/python_build.*|
+ .*thirdparty.*|
+ .*platform/android/java/lib/src/com.*|
+ .*-so_wrap.*|
+ platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView.*|
+ platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper.*|
+ platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.*
+ )