.pre-commit-config.yaml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. repos:
  2. - repo: https://github.com/pre-commit/pre-commit-hooks
  3. rev: v3.2.0
  4. hooks:
  5. - id: trailing-whitespace
  6. exclude: target_chains/sui/vendor/|patches/
  7. - id: end-of-file-fixer
  8. exclude: target_chains/sui/vendor/|patches/
  9. - id: check-added-large-files
  10. exclude: target_chains/sui/vendor/|patches/
  11. # Hook to format many type of files in the repo
  12. # including solidity contracts.
  13. - repo: https://github.com/pre-commit/mirrors-prettier
  14. rev: "v2.7.1"
  15. hooks:
  16. - id: prettier
  17. additional_dependencies:
  18. - "prettier@2.7.1"
  19. - "prettier-plugin-solidity@1.0.0-rc.1"
  20. exclude: target_chains/sui/vendor/
  21. - repo: local
  22. hooks:
  23. # Hooks for the remote executor
  24. - id: cargo-fmt-remote-executor
  25. name: Cargo format for remote executor
  26. language: "rust"
  27. entry: cargo +nightly-2023-03-01 fmt --manifest-path ./governance/remote_executor/Cargo.toml --all -- --config-path rustfmt.toml
  28. pass_filenames: false
  29. files: governance/remote_executor
  30. - id: cargo-clippy-remote-executor
  31. name: Cargo clippy for remote executor
  32. language: "rust"
  33. entry: cargo +nightly-2023-03-01 clippy --manifest-path ./governance/remote_executor/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
  34. pass_filenames: false
  35. files: governance/remote_executor
  36. # Hooks for cosmwasm contract
  37. - id: cargo-fmt-cosmwasm
  38. name: Cargo format for cosmwasm contract
  39. language: "rust"
  40. entry: cargo +nightly-2023-03-01 fmt --manifest-path ./target_chains/cosmwasm/Cargo.toml --all -- --config-path rustfmt.toml
  41. pass_filenames: false
  42. files: target_chains/cosmwasm
  43. - id: cargo-clippy-cosmwasm
  44. name: Cargo clippy for cosmwasm contract
  45. language: "rust"
  46. entry: cargo +nightly-2023-03-01 clippy --manifest-path ./target_chains/cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
  47. pass_filenames: false
  48. files: target_chains/cosmwasm
  49. # Hooks for Hermes
  50. - id: cargo-fmt-hermes
  51. name: Cargo format for Hermes
  52. language: "rust"
  53. entry: cargo +nightly-2024-03-26 fmt --manifest-path ./apps/hermes/server/Cargo.toml --all -- --config-path rustfmt.toml
  54. pass_filenames: false
  55. files: apps/hermes
  56. - id: cargo-clippy-hermes
  57. name: Cargo clippy for Hermes
  58. language: "rust"
  59. entry: cargo +nightly-2024-03-26 clippy --manifest-path ./apps/hermes/server/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
  60. pass_filenames: false
  61. files: apps/hermes
  62. # Hooks for Fortuna
  63. - id: cargo-fmt-fortuna
  64. name: Cargo format for Fortuna
  65. language: "rust"
  66. entry: cargo +nightly-2023-07-23 fmt --manifest-path ./apps/fortuna/Cargo.toml --all -- --config-path rustfmt.toml
  67. pass_filenames: false
  68. files: apps/fortuna
  69. # Hooks for message buffer contract
  70. - id: cargo-fmt-message-buffer
  71. name: Cargo format for message buffer contract
  72. language: "rust"
  73. entry: cargo +nightly-2023-03-01 fmt --manifest-path ./pythnet/message_buffer/Cargo.toml --all -- --config-path rustfmt.toml
  74. pass_filenames: false
  75. files: pythnet/message_buffer
  76. - id: cargo-clippy-message-buffer
  77. name: Cargo clippy for message buffer contract
  78. language: "rust"
  79. entry: cargo +nightly-2023-03-01 clippy --manifest-path ./pythnet/message_buffer/Cargo.toml --tests --fix --allow-dirty --allow-staged --features test-bpf -- -D warnings
  80. pass_filenames: false
  81. files: pythnet/message_buffer
  82. # Hooks for pythnet_sdk
  83. - id: cargo-fmt-pythnet-sdk
  84. name: Cargo format for pythnet SDK
  85. language: "rust"
  86. entry: cargo +nightly-2024-03-26 fmt --manifest-path ./pythnet/pythnet_sdk/Cargo.toml --all -- --config-path rustfmt.toml
  87. pass_filenames: false
  88. files: pythnet/pythnet_sdk
  89. - id: cargo-clippy-pythnet-sdk
  90. name: Cargo clippy for pythnet SDK
  91. language: "rust"
  92. entry: cargo +nightly-2024-03-26 clippy --manifest-path ./pythnet/pythnet_sdk/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
  93. pass_filenames: false
  94. files: pythnet/pythnet_sdk
  95. # Hooks for solana receiver contract
  96. - id: cargo-fmt-pyth-solana-receiver
  97. name: Cargo format for solana target chain contract
  98. language: "rust"
  99. entry: cargo +nightly-2023-03-01 fmt --manifest-path ./target_chains/solana/Cargo.toml --all -- --config-path rustfmt.toml
  100. pass_filenames: false
  101. files: target_chains/solana
  102. - id: cargo-clippy-pyth-solana-receiver
  103. name: Cargo clippy for solana target chain contract
  104. language: "rust"
  105. entry: cargo +nightly-2023-03-01 clippy --manifest-path ./target_chains/solana/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
  106. pass_filenames: false
  107. files: target_chains/solana
  108. # For express relay python files
  109. - id: poetry-install
  110. name: poetry install
  111. entry: poetry -C express_relay/sdk/python/express_relay install
  112. pass_filenames: false
  113. files: express_relay/sdk/python/express_relay
  114. language: "system"
  115. - id: black
  116. name: black
  117. entry: poetry -C express_relay/sdk/python/express_relay run black
  118. files: express_relay/sdk/python/express_relay
  119. language: "system"
  120. - id: pyflakes
  121. name: pyflakes
  122. entry: poetry -C express_relay/sdk/python/express_relay run pyflakes
  123. files: express_relay/sdk/python/express_relay
  124. language: "system"
  125. - id: mypy
  126. name: mypy
  127. entry: poetry -C express_relay/sdk/python/express_relay run mypy
  128. files: express_relay/sdk/python/express_relay
  129. language: "system"