Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Integrate pre-commit for style checks #10267

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
# Install tools used by `_tools/format.sh`.
sudo apt-get -qq update
sudo apt-get -qq install dos2unix recode
sudo pip3 install -r requirements.txt
sudo pip3 install codespell

- name: Linter checks
run: |
bash _tools/format.sh
- name: Style checks via pre-commit
uses: pre-commit/[email protected]

codespell -D- -D _tools/codespell-dict.txt -I _tools/codespell-ignore.txt -x _tools/codespell-ignore-lines.txt -S tutorials/i18n/locales.rst {about,community,contributing,getting_started,tutorials}/{*.rst,**/*.rst,**/**/*.rst,**/**/**/*.rst}
- name: Install dependencies
run: sudo pip3 install -r requirements.txt

# Use dummy builder to improve performance as we don't need the generated HTML in this workflow.
- name: Sphinx build
Expand Down
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
default_language_version:
python: python3

repos:
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
files: ^(about|community|contributing|getting_started|tutorials)/.*\.rst$
additional_dependencies: [tomli]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
args: ['--fix=lf']
42 changes: 0 additions & 42 deletions _tools/format.sh

This file was deleted.

1 change: 0 additions & 1 deletion classes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1085,4 +1085,3 @@ Variant types
class_vector3i
class_vector4
class_vector4i

1 change: 0 additions & 1 deletion contributing/how_to_contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,3 @@ Community support
Chances are you looked for learning materials outside of what the documentation provides.
Without content creators covering the game development process, there would not be this big of a community today.
Therefore it seemed only right to mention them in a page about important contributions to the project.

1 change: 0 additions & 1 deletion getting_started/introduction/first_look_at_the_editor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,3 @@ Alternatively,
or built-in variable in the script editor.
* Right-clicking on nodes and choosing **Open Documentation** or choosing **Lookup Symbol**
for elements in script editor will directly open their documentation.

8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[tool.ruff]
line-length = 120

[tool.codespell]
dictionary = ["_tools/codespell-dict.txt", "-"]
ignore-words = "_tools/codespell-ignore.txt"
exclude-file = "_tools/codespell-ignore-lines.txt"
skip = "tutorials/i18n/locales.rst"
1 change: 0 additions & 1 deletion tutorials/assets_pipeline/escn_exporter/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ is not maintained or supported in Godot 4.x. While not officially supported, the
partially work for some Godot and Blender versions, particularly before Blender version 4.0.
For complete docs on the Blender exporter, see the
`previous version of this page <https://docs.godotengine.org/en/4.0/tutorials/assets_pipeline/escn_exporter/index.html>`__.

1 change: 0 additions & 1 deletion tutorials/editor/external_editor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,3 @@ Emacs
^^^^^

Check the official instructions to configure `LSP <https://github.com/godotengine/emacs-gdscript-mode#auto-completion-with-the-language-server-protocol-lsp>`_, and `DAP <https://github.com/godotengine/emacs-gdscript-mode#using-the-debugger>`_.

1 change: 0 additions & 1 deletion tutorials/navigation/navigation_using_navigationmeshes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -694,4 +694,3 @@ The following script uses the NavigationServer to update a navigation region wit
NavigationServer3D.RegionSetNavigationMesh(_regionRid, _navigationMesh);
}
}

1 change: 0 additions & 1 deletion tutorials/scripting/gdextension/gdextension_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,3 @@ If no path is supplied Godot will move the libraries into the same directory as
"res://bin/libdependency.linux.template_release.arm64.so" : "",
"res://bin/libdependency.linux.template_release.rv64.so" : ""
}

1 change: 0 additions & 1 deletion tutorials/xr/xr_action_map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,3 @@ This is why many XR runtimes only use it as a last resort and will attempt to us
This is our advice as well: limit your action map to the interaction profiles for devices you have actually tested your game with.
The Oculus Touch controller is widely used as a fallback controller by many runtimes.
If you are able to test your game using a Meta Rift or Quest and add this profile there is a high probability your game will work with other headsets.