.pre-commit-config.yaml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. exclude: |
  2. (?x)^(
  3. python/ray/core/generated/|
  4. python/ray/serve/generated/|
  5. python/ray/cloudpickle/|
  6. python/ray/_private/runtime_env/_clonevirtualenv.py|
  7. doc/external/
  8. )
  9. repos:
  10. - repo: https://github.com/pre-commit/pre-commit-hooks
  11. rev: v4.4.0
  12. hooks:
  13. - id: trailing-whitespace
  14. - id: end-of-file-fixer
  15. - id: check-added-large-files
  16. - id: check-ast
  17. exclude: |
  18. (?x)(
  19. python/ray/serve/tests/test_config_files/syntax_error\.py
  20. )$
  21. - id: check-json
  22. exclude: |
  23. (?x)^(
  24. # Intentionally bad json schema
  25. python/ray/tests/test_runtime_env_validation_bad_2_schema.json|
  26. # json5 comments prevent parsing
  27. python/asv.conf.json|
  28. rllib/asv.conf.json
  29. )
  30. - id: check-toml
  31. - repo: https://github.com/psf/black
  32. rev: 22.10.0
  33. hooks:
  34. - id: black
  35. exclude: |
  36. (?x)^(
  37. python/ray/cloudpickle/|
  38. python/build/|
  39. python/ray/core/src/ray/gcs/|
  40. python/ray/thirdparty_files/|
  41. python/ray/_private/thirdparty/|
  42. python/ray/serve/tests/test_config_files/syntax_error\.py|
  43. python/ray/serve/_private/benchmarks/streaming/_grpc/test_server_pb2_grpc\.py|
  44. doc/external/
  45. )
  46. types_or: [python]
  47. - repo: https://github.com/pycqa/flake8
  48. rev: 3.9.1
  49. hooks:
  50. - id: flake8
  51. additional_dependencies:
  52. [
  53. flake8-comprehensions==3.10.1,
  54. flake8-quotes==2.0.0,
  55. flake8-bugbear==21.9.2,
  56. ]
  57. - repo: https://github.com/pre-commit/mirrors-prettier
  58. rev: v3.0.3
  59. hooks:
  60. - id: prettier
  61. files: 'doc/'
  62. types_or: [javascript, ts, tsx, html, css]
  63. - repo: https://github.com/pre-commit/mirrors-mypy
  64. rev: v1.7.0
  65. hooks:
  66. - id: mypy
  67. args: ['--follow-imports=skip', '--ignore-missing-imports']
  68. files: |
  69. (?x)^(
  70. python/ray/autoscaler/node_provider.py|
  71. python/ray/autoscaler/sdk/__init__.py|
  72. python/ray/autoscaler/sdk/sdk.py|
  73. python/ray/autoscaler/_private/commands.py|
  74. python/ray/autoscaler/_private/autoscaler.py|
  75. python/ray/_private/gcs_utils.py
  76. )
  77. additional_dependencies:
  78. [
  79. types-PyYAML==6.0.12.2,
  80. ]
  81. - repo: https://github.com/pycqa/isort
  82. rev: 5.12.0
  83. hooks:
  84. - id: isort
  85. name: isort (python)
  86. types_or: [python]
  87. - repo: https://github.com/pre-commit/pygrep-hooks
  88. rev: v1.10.0
  89. hooks:
  90. - id: rst-directive-colons
  91. - id: rst-inline-touching-normal
  92. - id: python-no-log-warn
  93. - id: python-check-mock-methods
  94. - repo: https://github.com/koalaman/shellcheck-precommit
  95. rev: v0.9.0
  96. hooks:
  97. - id: shellcheck
  98. args: ['--exclude=1090,1091,2207']
  99. # 1090: Can't follow non-constant source. Use a directive to specify location.
  100. # 1091: Not following {file} due to some error
  101. # 2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting). -- these aren't compatible with macOS's old Bash
  102. - repo: https://github.com/pocc/pre-commit-hooks
  103. rev: v1.3.5
  104. hooks:
  105. - id: clang-format
  106. args: [--version=12.0.1]
  107. - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
  108. rev: v2.11.0
  109. hooks:
  110. - id: pretty-format-java
  111. args: [--autofix, --google-java-formatter-version=1.7]
  112. exclude: |
  113. (?x)^(
  114. java/api/src/main/java/io/ray/api/ActorCall.java|
  115. java/api/src/main/java/io/ray/api/CppActorCall.java|
  116. java/api/src/main/java/io/ray/api/PyActorCall.java|
  117. java/api/src/main/java/io/ray/api/RayCall.java
  118. )
  119. - repo: local
  120. hooks:
  121. - id: docstyle
  122. name: Check for Ray docstyle violations
  123. entry: ci/lint/check-docstyle.sh
  124. language: system
  125. types: [python]
  126. - repo: local
  127. hooks:
  128. - id: check-import-order
  129. name: Check for Ray import order violations
  130. entry: python ci/lint/check_import_order.py
  131. language: python
  132. types: [python]
  133. pass_filenames: false
  134. args: [".", "-s", "ci", "-s", "python/ray/thirdparty_files", "-s", "python/build", "-s", "lib"]