Skip to content

Commit

Permalink
Add code spellcheck CI job (#3467)
Browse files Browse the repository at this point in the history
### Description

Fix spelling mistakes and create codespell CI job.
An extension of #3422 with the remaining mistakes fixed

### Backward compatibility

Yes

---------

Co-authored-by: miles <66052478+miles-six@users.noreply.github.com>
Co-authored-by: Paul Balaji <paul@hyperlane.xyz>
  • Loading branch information
3 people authored Mar 26, 2024
1 parent 7913d72 commit adab1be
Show file tree
Hide file tree
Showing 34 changed files with 86 additions and 38 deletions.
5 changes: 5 additions & 0 deletions .codespell/.codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[codespell]
skip = .git,node_modules,yarn.lock,Cargo.lock,./typescript/helloworld
count =
quiet-level = 3
ignore-words = ./.codespell/ignore.txt
7 changes: 7 additions & 0 deletions .codespell/ignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
crate
receipient
received
receivedFrom
ser
readded
re-use
1 change: 1 addition & 0 deletions .codespell/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
codespell==2.2.6
35 changes: 35 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# A Github action that using codespell to check spelling.
# see .codespell/* for configs
# https://github.com/codespell-project/codespell

name: codespell

on:
# Triggers the workflow on push or pull request against main
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
codespell:
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Install prerequisites
run: sudo pip install -r ./.codespell/requirements.txt

- name: Spell check
run: codespell --config=./.codespell/.codespellrc
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This CoC applies to all members of the Hyperlane Network's community including,
3. Treat your fellow contributors with respect, fairness, and professionalism, especially in situations of high pressure.
4. Seek, offer, and accept objective critism of yours and others work, strive to acknowledge the contributions of others.
5. Be transparent and honest about your qualifications and any potential conflicts of interest. Transparency is a key tenant of the Hyperlane project and we expect it from all contributors.
6. Bring an open and curious mind, the Hyperlane project is designed to enable developers to express their curiousity, experiment, and build things we couldn't have imagined ourselves.
6. Bring an open and curious mind, the Hyperlane project is designed to enable developers to express their curiosity, experiment, and build things we couldn't have imagined ourselves.
7. Stay on track - Do your best to avoid off-topic discussion and make sure you are posting to the correct channel and repositories. Distractions are costly and it is far too easy for work to go off track.
8. Step down properly - Think of your fellow contributors when you step down from the project. Contributors of open-source projects come and go. It is crucial that when you leave the project or reduce your contribution significantly you do so in a way that minimizes disruption and keeps continuity in mind. Concretely this means telling your fellow contributors you are leaving and taking the proper steps to enable a smooth transition for other contributors to pick up where you left off.
9. Respect the privacy of others, and take extreme care to protect confidential data when you are exposed to it.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to Hyperlane

We'd love for you to contribue to Hyperlane! Here are the guidelines to follow when contributing:
We'd love for you to contribute to Hyperlane! Here are the guidelines to follow when contributing:

- [Code of Conduct](#coc)
- [Questions and Problems](#question)
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ comment:
component_management:
default_rules: # default rules that will be inherited by all components
statuses:
- type: project # in this case every component that doens't have a status defined will have a project type one
- type: project # in this case every component that does not have a status defined will have a project type one
target: auto
branches:
- "!main"
Expand Down
2 changes: 1 addition & 1 deletion rust/chains/hyperlane-cosmos/src/trait_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct ConnectionConf {
chain_id: String,
/// The human readable address prefix for the chains using bech32.
bech32_prefix: String,
/// Canoncial Assets Denom
/// Canonical Assets Denom
canonical_asset: String,
/// The gas price set by the cosmos-sdk validator. Note that this represents the
/// minimum price set by the validator.
Expand Down
2 changes: 1 addition & 1 deletion rust/chains/hyperlane-fuel/src/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use hyperlane_core::H256;

/// Conversion from a fuel type to H256 primitive.
pub trait FuelIntoH256 {
/// Covert to an H256 primitive.
/// Convert to an H256 primitive.
fn into_h256(self) -> H256;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ mod test {
let expected_range = 900..=1000;
assert_eq!(range, expected_range);

// Update the cursor with some paritally bogus logs:
// Update the cursor with some partially bogus logs:
// - Three logs of sequence 99, i.e. duplicated
// - A log at sequence 100, which was already indexed and should be ignored
cursor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ pub(crate) mod test {
let expected_range = 90..=100;
assert_eq!(range, expected_range);

// Update the cursor with some paritally bogus logs:
// Update the cursor with some partially bogus logs:
// - A log at sequence 4, which was already indexed and should be ignored
// - Three logs of sequence 5, i.e. duplicated
// - A log at sequence 6, which is unexpected, but tolerated nonetheless
Expand Down
2 changes: 1 addition & 1 deletion rust/hyperlane-base/src/types/gcs_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl GcsStorageClientBuilder {
}

impl GcsStorageClient {
// convinience formatter
// convenience formatter
fn get_checkpoint_key(index: u32) -> String {
format!("checkpoint_{index}_with_id.json")
}
Expand Down
4 changes: 2 additions & 2 deletions rust/hyperlane-core/src/accumulator/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{
// - remove ring dependency
// In accordance with its license terms, the apache2 license is reproduced below

// Can't initialize this using `lazy_static` because of a constaint in Solana: static variables cannot be writable.
// Can't initialize this using `lazy_static` because of a constraint in Solana: static variables cannot be writable.
// See the following links for more info:
// https://stackoverflow.com/questions/70630344/failed-to-deploy-my-solana-smart-contract
// https://docs.solana.com/developing/on-chain-programs/limitations#static-writable-data
Expand Down Expand Up @@ -474,7 +474,7 @@ mod tests {

let leaf_b11 = H256::from([0xDD; 32]);
tree.push_leaf(leaf_b11, depth)
.expect("Pushing in outtermost leaf failed");
.expect("Pushing in outermost leaf failed");
let expected_tree = MerkleTree::create(&[leaf_b00, leaf_b01, leaf_b10, leaf_b11], depth);
assert_eq!(tree.hash(), expected_tree.hash());

Expand Down
2 changes: 1 addition & 1 deletion rust/hyperlane-core/src/config/str_or_int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub enum StrOrIntParseError {
/// The provided integer does not match the type requirements.
#[error("Provided number is an invalid integer: {0}")]
InvalidInt(#[from] TryFromIntError),
/// Some other error occured.
/// Some other error occurred.
#[error("Could not parse integer: {0}")]
Other(String),
}
2 changes: 1 addition & 1 deletion rust/hyperlane-core/src/rpc_clients/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl<T, B> FallbackProviderBuilder<T, B> {
}

/// Only used for testing purposes.
/// TODO: Move tests into this crate to control the visiblity with conditional compilation.
/// TODO: Move tests into this crate to control the visibility with conditional compilation.
pub fn with_max_block_time(mut self, max_block_time: Duration) -> Self {
self.max_block_time = max_block_time;
self
Expand Down
2 changes: 1 addition & 1 deletion rust/hyperlane-core/src/traits/validator_announce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ pub trait ValidatorAnnounce: HyperlaneContract + Send + Sync + Debug {
) -> ChainResult<TxOutcome>;

/// Returns the number of additional tokens needed to pay for the announce
/// transaction. Return `None` if the needed tokens canno tbe determined.
/// transaction. Return `None` if the needed tokens cannot be determined.
async fn announce_tokens_needed(&self, announcement: SignedType<Announcement>) -> Option<U256>;
}
2 changes: 1 addition & 1 deletion rust/utils/run-locally/src/cosmos/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct IgpInstantiateMsg {
pub owner: String,
pub gas_token: String,
pub beneficiary: String,
pub default_gas_usage: String, // u128 doesnt work with cw_serde
pub default_gas_usage: String, // u128 does not work with cw_serde
}

#[cw_serde]
Expand Down
2 changes: 1 addition & 1 deletion rust/utils/run-locally/src/solana.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub fn install_solana_cli_tools() -> (PathBuf, impl ArbitraryData) {
let solana_tools_dir = tempdir().unwrap();
log!("Downloading solana cli release v{}", SOLANA_CLI_VERSION);
let solana_release_name = {
// best effort ot pick one of the supported targets
// best effort to pick one of the supported targets
let target = if cfg!(target_os = "linux") {
"x86_64-unknown-linux-gnu"
} else if cfg!(target_os = "macos") {
Expand Down
2 changes: 1 addition & 1 deletion solidity/contracts/isms/ccip-read/AbstractCcipReadIsm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {AbstractMultisigIsm} from "../multisig/AbstractMultisigIsm.sol";
* @title AbstractCcipReadIsm
* @notice An ISM that allows arbitrary payloads to be submitted and verified on chain
* @dev https://eips.ethereum.org/EIPS/eip-3668
* @dev The AbstractCcipReadIsm provided by Hyperlane is left intentially minimalist as
* @dev The AbstractCcipReadIsm provided by Hyperlane is left intentionally minimalist as
* the range of applications that could be supported by a CcipReadIsm are so broad. However
* there are few things to note when building a custom CcipReadIsm.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Ini

/**
* @title AbstractMessageIdAuthorizedIsm
* @notice Uses external verfication options to verify interchain messages which need a authorized caller
* @notice Uses external verification options to verify interchain messages which need a authorized caller
*/
abstract contract AbstractMessageIdAuthorizedIsm is
IInterchainSecurityModule,
Expand Down
4 changes: 2 additions & 2 deletions solidity/contracts/isms/hook/layer-zero/LayerZeroV2Ism.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ contract LayerZeroV2Ism is AbstractMessageIdAuthorizedIsm {
/**
* @notice Entry point for receiving msg/packet from the LayerZero endpoint.
* @param _lzMessage The payload of the received message.
* @dev Authorization verifcation is done within verifyMessageId() -> _isAuthorized()
* @dev Authorization verification is done within verifyMessageId() -> _isAuthorized()
*/
function lzReceive(
Origin calldata,
Expand All @@ -83,7 +83,7 @@ contract LayerZeroV2Ism is AbstractMessageIdAuthorizedIsm {
}

/**
* @notice Validates criterias to verify a message
* @notice Validates criteria to verify a message
* @dev this is called by AbstractMessageIdAuthorizedIsm.verifyMessageId
* @dev parses msg.value to get parameters from lzReceive()
*/
Expand Down
2 changes: 1 addition & 1 deletion solidity/contracts/token/extensions/HypNativeScaled.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ contract HypNativeScaled is HypNative {
}

/**
* @dev Sends scaled `_amount` (multipled by `scale`) to `_recipient`.
* @dev Sends scaled `_amount` (multiplied by `scale`) to `_recipient`.
* @inheritdoc TokenRouter
*/
function _transferTo(
Expand Down
6 changes: 3 additions & 3 deletions solidity/contracts/token/libs/FastTokenRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ abstract contract FastTokenRouter is TokenRouter {

/**
* @dev allows an external user to full an unfilled fast transfer order.
* @param _recipient The recepient of the wrapped token on base chain.
* @param _recipient The recipient of the wrapped token on base chain.
* @param _amount The amount of wrapped tokens that is being bridged.
* @param _fastFee The fee the bridging entity will pay.
* @param _fastTransferId Id assigned on the remote chain to uniquely identify the transfer.
Expand Down Expand Up @@ -131,8 +131,8 @@ abstract contract FastTokenRouter is TokenRouter {
}

/**
* @dev returns an address that indicates who should recieve the bridged tokens.
* @dev if _fastFees was inlcuded and someone filled the order before the mailbox made the contract call, the filler gets the funds.
* @dev returns an address that indicates who should receive the bridged tokens.
* @dev if _fastFees was included and someone filled the order before the mailbox made the contract call, the filler gets the funds.
*/
function _getTokenRecipient(
address _recipient,
Expand Down
2 changes: 1 addition & 1 deletion solidity/test/isms/OPStackIsm.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ contract OPStackIsmTest is Test {

vm.selectFork(optimismFork);

// needs to be called by the cannonical messenger on Optimism
// needs to be called by the canonical messenger on Optimism
vm.expectRevert(NotCrossChainCall.selector);
opISM.verifyMessageId(messageId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract PortalAdapterTest is Test {
function testAdapter(uint256 amount) public {
// Transfers of 0 are invalid
vm.assume(amount > 0);
// Calls MockPortalBridge with the right paramters
// Calls MockPortalBridge with the right parameters
vm.expectCall(
address(portalBridge),
abi.encodeCall(
Expand Down
4 changes: 2 additions & 2 deletions typescript/ccip-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ProofsServiceAbi } from './abis/ProofsServiceAbi';
import * as config from './config';
import { ProofsService } from './services/ProofsService';

// Initalize Services
// Initialize Services
const proofsService = new ProofsService(
config.LIGHT_CLIENT_ADDR,
config.RPC_ADDRESS,
Expand All @@ -14,7 +14,7 @@ const proofsService = new ProofsService(
config.SUCCINCT_API_KEY,
);

// Initalize Server and add Service handlers
// Initialize Server and add Service handlers
const server = new Server();

server.add(ProofsServiceAbi, [
Expand Down
2 changes: 1 addition & 1 deletion typescript/ccip-server/src/services/LightClientService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LightClientService {
}

/**
* Calculates the slot given a timestamp, and the LightClient's configured Genesis Time and Secods Per Slot
* Calculates the slot given a timestamp, and the LightClient's configured Genesis Time and Seconds Per Slot
* @param timestamp timestamp to calculate slot with
*/
async calculateSlot(timestamp: bigint): Promise<bigint> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ Regardless, workload identities are a more attractive long-term option, and movi

## What is external-secrets?

The [documentation](https://external-secrets.io/v0.4.4/) is the best source. In short, it allows Kuberenetes Secrets to get their secrets from an external secret provided (like GCP's Secret Manager), all without a developer/deployer needing to touch the secrets themselves.
The [documentation](https://external-secrets.io/v0.4.4/) is the best source. In short, it allows Kubernetes Secrets to get their secrets from an external secret provided (like GCP's Secret Manager), all without a developer/deployer needing to touch the secrets themselves.

The general idea is there are `SecretStore`s (or `ClusterSecretStore`s, which are the cluster-wide version), that specify how the cluster can authenticate with the external secret provider. `ExternalSecret`s can then be specified in "application" infrastructure, which allow developers to specify a template for a Secret that will be created using the secret values from the external provider (& using the credentials from the SecretStore).
2 changes: 1 addition & 1 deletion typescript/infra/src/utils/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function submitMetrics(
* Start a simple HTTP server to host metrics. This just takes the registry and dumps the text
* string to people who request `GET /metrics`.
*
* PROMETHEUS_PORT env var is used to determine what port ot host on, defaults to 9090.
* PROMETHEUS_PORT env var is used to determine what port to host on, defaults to 9090.
*/
export function startMetricsServer(register: Registry): http.Server {
return http
Expand Down
2 changes: 1 addition & 1 deletion typescript/sdk/src/core/CoreDeployer.hardhat-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('core', async () => {
sinon.restore(); // restore normal deployer behavior and test3 will be deployed
const result = await deployer.deploy(coreConfig);
expect(result).to.have.keys(['test1', 'test2', 'test3']);
// Each test network key has entries about the other test networks, whre ISM details are stored.
// Each test network key has entries about the other test networks, where ISM details are stored.
// With this exception, the keys should be the same, so we check the intersections for equality.
const testnetKeysIntersection = Object.keys(result.test1).filter(
(key) =>
Expand Down
4 changes: 2 additions & 2 deletions typescript/sdk/src/core/HyperlaneCoreChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ export class HyperlaneCoreChecker extends HyperlaneAppChecker<
],
(bytecode) =>
// This is obviously super janky but basically we are searching
// for the ocurrences of localDomain in the bytecode and remove
// that to compare, but some coincidental ocurrences of
// for the occurrences of localDomain in the bytecode and remove
// that to compare, but some coincidental occurrences of
// localDomain in the bytecode should be not be removed which
// are just done via an offset guard
bytecode
Expand Down
2 changes: 1 addition & 1 deletion typescript/sdk/src/metadata/agentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export const RelayerAgentConfigSchema = AgentConfigSchema.extend({
.optional()
.describe('The path to the relayer database.'),
relayChains: CommaSeperatedChainList.describe(
'Comma seperated list of chains to relay messages between.',
'Comma separated list of chains to relay messages between.',
),
gasPaymentEnforcement: z
.union([z.array(GasPaymentEnforcementSchema), z.string().min(1)])
Expand Down
6 changes: 3 additions & 3 deletions typescript/sdk/src/token/Token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ describe('Token', () => {
const token = new Token(tokenArgs);
expect(token.standard).to.eql(tokenArgs.standard);
const adapter = token.getAdapter(multiProvider);
const adddress =
const address =
STANDARD_TO_ADDRESS[token.standard] ??
PROTOCOL_TO_ADDRESS[token.protocol];
if (!adddress)
if (!address)
throw new Error(`No address for standard ${tokenArgs.standard}`);
const balance = await adapter.getBalance(adddress);
const balance = await adapter.getBalance(address);
expect(typeof balance).to.eql('bigint');
}
})
Expand Down
2 changes: 1 addition & 1 deletion typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class CwHypSyntheticAdapter
// amount: BigInt(resp.gas_amount?.amount || 0),
// addressOrDenom: resp.gas_amount?.denom,
// };
throw new Error('CW adpater quoteTransferRemoteGas method not implemented');
throw new Error('CW adapter quoteTransferRemoteGas method not implemented');
}

async populateTransferRemoteTx({
Expand Down

0 comments on commit adab1be

Please sign in to comment.