0.2.0-dev Download ZIP
231 lines ·7.4 KB Raw
| 1 | default_language_version: |
| 2 | python: python3 |
| 3 | |
| 4 | exclude: | |
| 5 | (?x)^( |
| 6 | .*thirdparty/.*| |
| 7 | .*-(dll|dylib|so)_wrap\.[ch]| |
| 8 | platform/android/java/editor/src/main/java/com/android/.*| |
| 9 | platform/android/java/lib/src/main/java/com/google/.* |
| 10 | )$ |
| 11 | |
| 12 | repos: |
| 13 | - repo: https://github.com/pre-commit/pre-commit-hooks |
| 14 | rev: v6.0.0 |
| 15 | hooks: |
| 16 | - id: check-executables-have-shebangs |
| 17 | - id: check-shebang-scripts-are-executable |
| 18 | exclude: (SConstruct|SCsub)$ # SCons files use shebangs for syntax highlighting only. |
| 19 | |
| 20 | - repo: https://github.com/pre-commit/mirrors-clang-format |
| 21 | rev: v22.1.5 |
| 22 | hooks: |
| 23 | - id: clang-format |
| 24 | files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc|java)$ |
| 25 | types_or: [text] |
| 26 | - id: clang-format |
| 27 | name: clang-format-glsl |
| 28 | files: \.glsl$ |
| 29 | types_or: [text] |
| 30 | args: [-style=file:misc/utility/clang_format_glsl.yml] |
| 31 | |
| 32 | # Not automatically triggered (because it requires compile_commands.json to be up-to-date). |
| 33 | # Invoke it manually via `prek run --hook-stage manual clangd-tidy` |
| 34 | - repo: https://github.com/repiteo/clangd-tidy |
| 35 | rev: v1.1.1.dev1 |
| 36 | hooks: |
| 37 | - id: clangd-tidy |
| 38 | # TODO: Platform-specific subfolders currently fail, we should try to include them. |
| 39 | exclude: | |
| 40 | (?x)^( |
| 41 | (driver|platform)/\w+/.*| |
| 42 | editor/shader/shader_baker/shader_baker_export_plugin_platform_.*| |
| 43 | modules/camera/camera_.*| |
| 44 | modules/openxr/extensions/platform/.* |
| 45 | )$ |
| 46 | args: [ |
| 47 | --fix, |
| 48 | --color=always, |
| 49 | # TODO: `inc` ignored for now, because they don't include their parent header. |
| 50 | "--allow-extensions=c,h,cpp,hpp,cc,hh,cxx,hxx,m,mm", |
| 51 | ] |
| 52 | additional_dependencies: [clangd, clang-tidy==22.1.7] |
| 53 | stages: [manual] |
| 54 | |
| 55 | - repo: https://github.com/astral-sh/ruff-pre-commit |
| 56 | rev: v0.17.1 |
| 57 | hooks: |
| 58 | - id: ruff-check |
| 59 | args: [--color=always] |
| 60 | files: (\.py|SConstruct|SCsub)$ |
| 61 | types_or: [text] |
| 62 | - id: ruff-format |
| 63 | args: [--color=always] |
| 64 | files: (\.py|SConstruct|SCsub)$ |
| 65 | types_or: [text] |
| 66 | |
| 67 | - repo: https://github.com/pre-commit/mirrors-mypy |
| 68 | rev: v2.4.0 |
| 69 | hooks: |
| 70 | - id: mypy |
| 71 | files: \.py$ |
| 72 | types_or: [text] |
| 73 | |
| 74 | - repo: https://github.com/codespell-project/codespell |
| 75 | rev: v2.4.2 |
| 76 | hooks: |
| 77 | - id: codespell |
| 78 | additional_dependencies: [tomli] |
| 79 | |
| 80 | - repo: https://github.com/python-jsonschema/check-jsonschema |
| 81 | rev: 0.37.4 |
| 82 | hooks: |
| 83 | - id: check-jsonschema |
| 84 | files: ^core/extension/gdextension_interface\.json$ |
| 85 | args: ["--schemafile", "core/extension/gdextension_interface.schema.json"] |
| 86 | |
| 87 | - repo: local |
| 88 | hooks: |
| 89 | - id: make-rst |
| 90 | name: make-rst |
| 91 | language: python |
| 92 | entry: python doc/tools/make_rst.py |
| 93 | args: [doc/classes, modules, platform, --dry-run, --color] |
| 94 | pass_filenames: false |
| 95 | files: ^(doc/classes|.*/doc_classes)/.*\.xml$ |
| 96 | |
| 97 | - id: doc-status |
| 98 | name: doc-status |
| 99 | language: python |
| 100 | entry: python doc/tools/doc_status.py |
| 101 | args: [doc/classes, modules/*/doc_classes, platform/*/doc_classes, -c] |
| 102 | pass_filenames: false |
| 103 | files: ^(doc/classes|.*/doc_classes)/.*\.xml$ |
| 104 | |
| 105 | - id: validate-builders |
| 106 | name: validate-builders |
| 107 | language: python |
| 108 | entry: python tests/python_build/validate_builders.py |
| 109 | pass_filenames: false |
| 110 | files: ^(gles3|glsl)_builders\.py$ |
| 111 | |
| 112 | - id: validate-xml |
| 113 | name: validate-xml |
| 114 | language: python |
| 115 | entry: python misc/scripts/validate_xml.py |
| 116 | files: ^(doc/classes|.*/doc_classes)/.*\.xml$ |
| 117 | additional_dependencies: [xmlschema] |
| 118 | |
| 119 | - id: validate-codeowners |
| 120 | name: validate-codeowners |
| 121 | language: python |
| 122 | entry: python misc/scripts/validate_codeowners.py |
| 123 | args: [--unowned] |
| 124 | |
| 125 | - id: validate-includes |
| 126 | name: validate-includes |
| 127 | language: python |
| 128 | entry: python misc/scripts/validate_includes.py |
| 129 | files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc)$ |
| 130 | |
| 131 | - id: eslint |
| 132 | name: eslint |
| 133 | language: node |
| 134 | entry: eslint |
| 135 | files: ^(platform/web/js/|modules/|misc/dist/html/).*\.(js|html)$ |
| 136 | args: |
| 137 | - --fix |
| 138 | - --no-warn-ignored |
| 139 | - --no-config-lookup |
| 140 | - --config |
| 141 | - platform/web/eslint.config.cjs |
| 142 | additional_dependencies: |
| 143 | - "@eslint/js@^9.12.0" |
| 144 | - "@html-eslint/eslint-plugin@^0.27.0" |
| 145 | - "@html-eslint/parser@^0.27.0" |
| 146 | - "@stylistic/eslint-plugin@^2.13.0" |
| 147 | - eslint@^9.39.5 |
| 148 | - eslint-plugin-html@^8.2.0 |
| 149 | - espree@^10.4.0 |
| 150 | - globals@^15.15.0 |
| 151 | |
| 152 | - id: jsdoc |
| 153 | name: jsdoc |
| 154 | language: node |
| 155 | entry: jsdoc |
| 156 | files: ^platform/web/js/engine/(engine|config|features)\.js$ |
| 157 | args: |
| 158 | - --template |
| 159 | - platform/web/js/jsdoc2rst/ |
| 160 | - platform/web/js/engine/engine.js |
| 161 | - platform/web/js/engine/config.js |
| 162 | - platform/web/js/engine/features.js |
| 163 | - --destination |
| 164 | - "" |
| 165 | - -d |
| 166 | - dry-run |
| 167 | pass_filenames: false |
| 168 | additional_dependencies: [jsdoc@^4.0.3] |
| 169 | |
| 170 | - id: svgo |
| 171 | name: svgo |
| 172 | language: node |
| 173 | entry: svgo |
| 174 | files: \.svg$ |
| 175 | args: [--quiet, --config, misc/utility/svgo.config.mjs] |
| 176 | additional_dependencies: [svgo@4.0.1] |
| 177 | |
| 178 | - id: copyright-headers |
| 179 | name: copyright-headers |
| 180 | language: python |
| 181 | entry: python misc/scripts/copyright_headers.py |
| 182 | files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc|java)$ |
| 183 | exclude: | |
| 184 | (?x)^( |
| 185 | core/math/bvh_.*\.inc| |
| 186 | platform/(?!android|ios|linuxbsd|macos|visionos|web|windows)\w+/.*| |
| 187 | platform/android/java/lib/src/main/java/org/godotengine/godot/gl/GLSurfaceView\.java| |
| 188 | platform/android/java/lib/src/main/java/org/godotengine/godot/gl/EGLLogWrapper\.java| |
| 189 | platform/android/java/lib/src/main/java/org/godotengine/godot/utils/ProcessPhoenix\.java |
| 190 | )$ |
| 191 | |
| 192 | - id: header-guards |
| 193 | name: header-guards |
| 194 | language: python |
| 195 | entry: python misc/scripts/header_guards.py |
| 196 | files: \.(h|hpp|hh|hxx)$ |
| 197 | |
| 198 | - id: file-format |
| 199 | name: file-format |
| 200 | language: python |
| 201 | entry: python misc/scripts/file_format.py |
| 202 | types_or: [text] |
| 203 | exclude: | |
| 204 | (?x)^( |
| 205 | .*\.test\.txt| |
| 206 | .*\.svg| |
| 207 | .*\.patch| |
| 208 | .*\.out| |
| 209 | modules/gdscript/tests/scripts/parser/features/mixed_indentation_on_blank_lines\.gd| |
| 210 | modules/gdscript/tests/scripts/parser/warnings/empty_file_newline_comment\.norun\.gd| |
| 211 | modules/gdscript/tests/scripts/parser/warnings/empty_file_newline\.norun\.gd| |
| 212 | tests/data/.*\.bin |
| 213 | )$ |
| 214 | |
| 215 | - id: dotnet-format |
| 216 | name: dotnet-format |
| 217 | language: python |
| 218 | entry: python misc/scripts/dotnet_format.py |
| 219 | types_or: [c#] |
| 220 | # |
| 221 | # End of upstream Godot pre-commit hooks. |
| 222 | # |
| 223 | # Keep this separation to let downstream forks add their own hooks to this file, |
| 224 | # without running into merge conflicts when rebasing on latest upstream. |
| 225 | # |
| 226 | # Start of downstream pre-commit hooks. |
| 227 | # |
| 228 | # This is still the "repo: local" scope, so new local hooks can be defined directly at this indentation: |
| 229 | # - id: new-local-hook |
| 230 | # To add external repo hooks, bring the indentation back to: |
| 231 | # - repo: my-remote-hook |