.pre-commit-config.yaml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. exclude: |
  2. (?x)^(
  3. .*thirdparty/.*|
  4. .*-so_wrap\.(h|c)$
  5. )
  6. repos:
  7. - repo: https://github.com/pre-commit/mirrors-clang-format
  8. rev: v17.0.6
  9. hooks:
  10. - id: clang-format
  11. files: \.(c|h|cpp|hpp|cc|cxx|m|mm|inc|java|glsl)$
  12. types_or: [text]
  13. exclude: |
  14. (?x)^(
  15. tests/python_build/.*|
  16. platform/android/java/lib/src/com/.*
  17. )
  18. - repo: https://github.com/psf/black-pre-commit-mirror
  19. rev: 24.2.0
  20. hooks:
  21. - id: black
  22. files: (\.py$|SConstruct|SCsub)
  23. types_or: [text]
  24. - repo: https://github.com/pre-commit/mirrors-mypy
  25. rev: v0.971
  26. hooks:
  27. - id: mypy
  28. files: \.py$
  29. types_or: [text]
  30. - repo: https://github.com/codespell-project/codespell
  31. rev: v2.2.6
  32. hooks:
  33. - id: codespell
  34. types_or: [text]
  35. exclude: |
  36. (?x)^(
  37. .*\.desktop$|
  38. .*\.gitignore$|
  39. .*\.po$|
  40. .*\.pot$|
  41. .*\.rc$|
  42. \.mailmap$|
  43. AUTHORS.md$|
  44. COPYRIGHT.txt$|
  45. DONORS.md$|
  46. core/input/gamecontrollerdb.txt$|
  47. core/string/locales.h$|
  48. editor/project_converter_3_to_4.cpp$|
  49. platform/android/java/lib/src/com/.*|
  50. platform/web/package-lock.json$
  51. )
  52. args:
  53. - --enable-colors
  54. - --write-changes
  55. - --check-hidden
  56. - --quiet-level
  57. - '3'
  58. - --ignore-words-list
  59. - aesthetic,aesthetics,breaked,cancelled,colour,curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,mis,nd,numer,ot,requestor,te,thirdparty,vai
  60. - --builtin
  61. - clear,rare,en-GB_to_en-US
  62. ### Requires Docker; look into alternative implementation.
  63. # - repo: https://github.com/comkieffer/pre-commit-xmllint.git
  64. # rev: 1.0.0
  65. # hooks:
  66. # - id: xmllint
  67. # language: docker
  68. # types_or: [text]
  69. # files: ^(doc/classes|.*/doc_classes)/.*\.xml$
  70. # args: [--schema, doc/class.xsd]
  71. - repo: https://github.com/pre-commit/mirrors-eslint
  72. rev: v8.46.0
  73. hooks:
  74. - id: eslint
  75. name: eslint-engine
  76. files: ^(platform/web/js/engine/|js/jsdoc2rst/).*\.js$
  77. args: [--fix, --no-eslintrc, --config, platform/web/.eslintrc.engine.js]
  78. additional_dependencies: &eslint-deps
  79. - eslint@8.46.0
  80. - eslint-config-airbnb-base@15.0.0
  81. - eslint-plugin-import@2.28.0
  82. - eslint-plugin-html@7.1.0
  83. - '@html-eslint/eslint-plugin@0.19.1'
  84. - '@html-eslint/parser@0.19.1'
  85. - id: eslint
  86. name: eslint-libs
  87. files: ^(platform/web/js/libs/|modules/).*\.js$
  88. args: [--fix, --no-eslintrc, --config, platform/web/.eslintrc.libs.js]
  89. additional_dependencies: *eslint-deps
  90. - id: eslint
  91. name: eslint-sw
  92. files: ^misc/dist/html/service-worker\.js$
  93. args: [--fix, --no-eslintrc, --config, platform/web/.eslintrc.sw.js]
  94. additional_dependencies: *eslint-deps
  95. - id: eslint
  96. name: eslint-html
  97. files: ^misc/dist/html/.*\.html$
  98. types: [html]
  99. args: [--fix, --no-eslintrc, --config, platform/web/.eslintrc.html.js]
  100. additional_dependencies: *eslint-deps
  101. - repo: local
  102. hooks:
  103. - id: make-rst
  104. name: make-rst
  105. language: python
  106. entry: python3 doc/tools/make_rst.py doc/classes modules platform --dry-run --color
  107. pass_filenames: false
  108. files: ^(doc/classes|.*/doc_classes)/.*\.xml$
  109. - id: doc-status
  110. name: doc-status
  111. language: python
  112. entry: python3 doc/tools/doc_status.py
  113. files: ^(doc/classes|.*/doc_classes)/.*\.xml$
  114. - id: jsdoc
  115. name: jsdoc
  116. language: node
  117. entry: jsdoc
  118. files: ^platform/web/js/engine/(engine|config|features)\.js$
  119. args:
  120. - --template
  121. - platform/web/js/jsdoc2rst/
  122. - platform/web/js/engine/engine.js
  123. - platform/web/js/engine/config.js
  124. - platform/web/js/engine/features.js
  125. - --destination
  126. - ''
  127. - -d
  128. - dry-run
  129. pass_filenames: false
  130. additional_dependencies: ['jsdoc@^4.0.3']
  131. - id: copyright-headers
  132. name: copyright-headers
  133. language: python
  134. entry: python3 misc/scripts/copyright_headers.py
  135. files: \.(c|h|cpp|hpp|cc|cxx|m|mm|inc|java)$
  136. exclude: |
  137. (?x)^(
  138. core/math/bvh_.*\.inc$|
  139. platform/android/java/lib/src/com/.*|
  140. platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView\.java$|
  141. platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper\.java$|
  142. platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix\.java$
  143. )
  144. - id: header-guards
  145. name: header-guards
  146. language: python
  147. entry: python3 misc/scripts/header_guards.py
  148. files: \.(h|hpp)$
  149. exclude: |
  150. (?x)^(
  151. .*/thread\.h$|
  152. .*/platform_config\.h$|
  153. .*/platform_gl\.$h
  154. )
  155. - id: file-format
  156. name: file-format
  157. language: python
  158. entry: python3 misc/scripts/file_format.py
  159. types_or: [text]
  160. exclude: |
  161. (?x)^(
  162. .*\.test\.txt$|
  163. .*\.svg$|
  164. .*\.patch$|
  165. .*\.out$|
  166. modules/gdscript/tests/scripts/parser/features/mixed_indentation_on_blank_lines\.gd$|
  167. modules/gdscript/tests/scripts/parser/warnings/empty_file_newline_comment\.notest\.gd$|
  168. modules/gdscript/tests/scripts/parser/warnings/empty_file_newline\.notest\.gd$|
  169. platform/android/java/lib/src/com/google/.*
  170. )
  171. - id: dotnet-format
  172. name: dotnet-format
  173. language: python
  174. entry: python3 misc/scripts/dotnet_format.py
  175. types_or: [c#]