.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. - 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 the attester
  34. - id: cargo-fmt-attester
  35. name: Cargo format for attester
  36. language: "rust"
  37. entry: cargo +nightly-2023-03-01 fmt --manifest-path ./wormhole_attester/Cargo.toml --all -- --config-path rustfmt.toml
  38. pass_filenames: false
  39. files: wormhole_attester
  40. - id: cargo-clippy-attester
  41. name: Cargo clippy for attester
  42. language: "rust"
  43. entry: |
  44. bash -c 'EMITTER_ADDRESS=0 BRIDGE_ADDRESS=0 cargo +nightly-2023-03-01 clippy --manifest-path \
  45. ./wormhole_attester/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings'
  46. pass_filenames: false
  47. files: wormhole_attester
  48. # Hooks for cosmwasm contract
  49. - id: cargo-fmt-cosmwasm
  50. name: Cargo format for cosmwasm contract
  51. language: "rust"
  52. entry: cargo +nightly-2023-03-01 fmt --manifest-path ./target_chains/cosmwasm/Cargo.toml --all -- --config-path rustfmt.toml
  53. pass_filenames: false
  54. files: target_chains/cosmwasm
  55. - id: cargo-clippy-cosmwasm
  56. name: Cargo clippy for cosmwasm contract
  57. language: "rust"
  58. entry: cargo +nightly-2023-03-01 clippy --manifest-path ./target_chains/cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
  59. pass_filenames: false
  60. files: target_chains/cosmwasm
  61. # Hooks for Hermes
  62. - id: cargo-fmt-hermes
  63. name: Cargo format for Pyth Hermes
  64. language: "rust"
  65. entry: cargo +nightly-2023-07-23 fmt --manifest-path ./hermes/Cargo.toml --all -- --config-path rustfmt.toml
  66. pass_filenames: false
  67. files: hermes
  68. # Hooks for Fortuna
  69. - id: cargo-fmt-fortuna
  70. name: Cargo format for Fortuna
  71. language: "rust"
  72. entry: cargo +nightly-2023-07-23 fmt --manifest-path ./fortuna/Cargo.toml --all -- --config-path rustfmt.toml
  73. pass_filenames: false
  74. files: fortuna
  75. # Hooks for message buffer contract
  76. - id: cargo-fmt-message-buffer
  77. name: Cargo format for message buffer contract
  78. language: "rust"
  79. entry: cargo +nightly-2023-03-01 fmt --manifest-path ./pythnet/message_buffer/Cargo.toml --all -- --config-path rustfmt.toml
  80. pass_filenames: false
  81. files: pythnet/message_buffer
  82. - id: cargo-clippy-message-buffer
  83. name: Cargo clippy for message buffer contract
  84. language: "rust"
  85. 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
  86. pass_filenames: false
  87. files: pythnet/message_buffer
  88. # Hooks for pythnet_sdk
  89. - id: cargo-fmt-pythnet-sdk
  90. name: Cargo format for pythnet SDK
  91. language: "rust"
  92. entry: cargo +nightly-2023-07-23 fmt --manifest-path ./pythnet/pythnet_sdk/Cargo.toml --all -- --config-path rustfmt.toml
  93. pass_filenames: false
  94. files: pythnet/pythnet_sdk
  95. - id: cargo-clippy-pythnet-sdk
  96. name: Cargo clippy for pythnet SDK
  97. language: "rust"
  98. entry: cargo +nightly-2023-07-23 clippy --manifest-path ./pythnet/pythnet_sdk/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
  99. pass_filenames: false
  100. files: pythnet/pythnet_sdk
  101. # Hooks for solana receiver contract
  102. - id: cargo-fmt-pyth-solana-receiver
  103. name: Cargo format for solana target chain contract
  104. language: "rust"
  105. entry: cargo +nightly-2023-03-01 fmt --manifest-path ./target_chains/solana/Cargo.toml --all -- --config-path rustfmt.toml
  106. pass_filenames: false
  107. files: target_chains/solana
  108. - id: cargo-clippy-pyth-solana-receiver
  109. name: Cargo clippy for solana target chain contract
  110. language: "rust"
  111. entry: cargo +nightly-2023-03-01 clippy --manifest-path ./target_chains/solana/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
  112. pass_filenames: false
  113. files: target_chains/solana
  114. # For express relay python files
  115. - id: black
  116. name: black
  117. entry: poetry -C express_relay/sdk/python/express_relay run black express_relay/sdk/python/express_relay
  118. pass_filenames: false
  119. language: "system"
  120. - id: pyflakes
  121. name: pyflakes
  122. entry: poetry -C express_relay/sdk/python/express_relay run pyflakes express_relay/sdk/python/express_relay
  123. pass_filenames: false
  124. language: "system"
  125. - id: mypy
  126. name: mypy
  127. entry: poetry -C express_relay/sdk/python/express_relay run mypy express_relay/sdk/python/express_relay
  128. pass_filenames: false
  129. language: "system"