.pre-commit-config.yaml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 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 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 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 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 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 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 fmt --manifest-path ./hermes/Cargo.toml --all -- --config-path rustfmt.toml
  66. pass_filenames: false
  67. files: hermes
  68. # Hooks for message buffer contract
  69. - id: cargo-fmt-message-buffer
  70. name: Cargo format for message buffer contract
  71. language: "rust"
  72. entry: cargo +nightly fmt --manifest-path ./pythnet/message_buffer/Cargo.toml --all -- --config-path rustfmt.toml
  73. pass_filenames: false
  74. files: pythnet/message_buffer
  75. - id: cargo-clippy-message-buffer
  76. name: Cargo clippy for message buffer contract
  77. language: "rust"
  78. entry: cargo +nightly clippy --manifest-path ./pythnet/message_buffer/Cargo.toml --tests --fix --allow-dirty --allow-staged --features test-bpf -- -D warnings
  79. pass_filenames: false
  80. files: pythnet/message_buffer
  81. # Hooks for pythnet_sdk
  82. - id: cargo-fmt-pythnet-sdk
  83. name: Cargo format for pythnet SDK
  84. language: "rust"
  85. entry: cargo +nightly fmt --manifest-path ./pythnet/pythnet_sdk/Cargo.toml --all -- --config-path rustfmt.toml
  86. pass_filenames: false
  87. files: pythnet/pythnet_sdk
  88. - id: cargo-clippy-pythnet-sdk
  89. name: Cargo clippy for pythnet SDK
  90. language: "rust"
  91. entry: cargo +nightly clippy --manifest-path ./pythnet/pythnet_sdk/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
  92. pass_filenames: false
  93. files: pythnet/pythnet_sdk
  94. # Hooks for solana receiver contract
  95. - id: cargo-fmt-solana-receiver
  96. name: Cargo format for solana target chain contract
  97. language: "rust"
  98. entry: cargo +nightly fmt --manifest-path ./target_chains/solana/Cargo.toml --all -- --config-path rustfmt.toml
  99. pass_filenames: false
  100. files: target_chains/solana
  101. - id: cargo-clippy-solana-receiver
  102. name: Cargo clippy for solana target chain contract
  103. language: "rust"
  104. entry: cargo +nightly clippy --manifest-path ./target_chains/solana/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
  105. pass_filenames: false
  106. files: target_chains/solana