.pre-commit-config.yaml 5.7 KB

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