1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-03 19:11:41 +00:00

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>
This commit is contained in:
Aarni Koskela
2024-01-09 14:47:16 +02:00
committed by Rémi Verschelde
parent bb6b06c813
commit 20c563de40
12 changed files with 53 additions and 889 deletions

View File

@@ -23,7 +23,7 @@ jobs:
- name: Install Python dependencies and general setup
run: |
pip3 install black==23.3.0 pytest==7.1.2 mypy==0.971
pip3 install pytest==7.1.2 mypy==0.971
git config diff.wsErrorHighlight all
- name: Get changed files
@@ -46,6 +46,9 @@ jobs:
run: |
bash ./misc/scripts/gitignore_check.sh
- name: Style checks via pre-commit
uses: pre-commit/action@v3.0.1
- name: File formatting checks (file_format.sh)
run: |
bash ./misc/scripts/file_format.sh changed.txt
@@ -54,14 +57,6 @@ jobs:
run: |
bash ./misc/scripts/header_guards.sh changed.txt
- name: Python style checks via black (black_format.sh)
run: |
if grep -qE '\.py$|SConstruct|SCsub' changed.txt || [ -z "$(cat changed.txt)" ]; then
bash ./misc/scripts/black_format.sh
else
echo "Skipping Python formatting as no Python files were changed."
fi
- name: Python scripts static analysis (mypy_check.sh)
run: |
if grep -qE '\.py$|SConstruct|SCsub' changed.txt || [ -z "$(cat changed.txt)" ]; then
@@ -92,12 +87,6 @@ jobs:
- name: Documentation checks
run: |
doc/tools/doc_status.py doc/classes modules/*/doc_classes platform/*/doc_classes
doc/tools/make_rst.py --dry-run --color doc/classes modules platform
- name: Style checks via clang-format (clang_format.sh)
run: |
clang-format --version
bash ./misc/scripts/clang_format.sh changed.txt
- name: Style checks via dotnet format (dotnet_format.sh)
run: |