From 8b3d4030522c6e74f5529e3b11ccdda3e5d812ed Mon Sep 17 00:00:00 2001 From: zjb0807 Date: Fri, 7 Mar 2025 10:39:16 +0800 Subject: [PATCH 1/3] add codespell --- .codespell/codespellrc | 5 +++++ .codespell/ignore.txt | 0 .codespell/requirements.txt | 1 + .github/workflows/codespell.yml | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 .codespell/codespellrc create mode 100644 .codespell/ignore.txt create mode 100644 .codespell/requirements.txt create mode 100644 .github/workflows/codespell.yml diff --git a/.codespell/codespellrc b/.codespell/codespellrc new file mode 100644 index 000000000..5e541e4fa --- /dev/null +++ b/.codespell/codespellrc @@ -0,0 +1,5 @@ +[codespell] +skip = .git,Cargo.lock +count = +quiet-level = 3 +ignore-words = ./.codespell/ignore.txt diff --git a/.codespell/ignore.txt b/.codespell/ignore.txt new file mode 100644 index 000000000..e69de29bb diff --git a/.codespell/requirements.txt b/.codespell/requirements.txt new file mode 100644 index 000000000..1bb55fb1c --- /dev/null +++ b/.codespell/requirements.txt @@ -0,0 +1 @@ +codespell==2.4.1 diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 000000000..ed5afcba0 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,33 @@ +# 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: [master] + pull_request: + branches: [master] + # 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: Setup python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install codespell requirements + run: pip install -r ./.codespell/requirements.txt + + - name: Spell check + run: codespell --config=./.codespell/codespellrc From fb465d5cf2bc0af1e6d0ea1859aaed9e66ba2d80 Mon Sep 17 00:00:00 2001 From: zjb0807 Date: Fri, 7 Mar 2025 10:45:04 +0800 Subject: [PATCH 2/3] fix typo --- authority/README.md | 4 ++-- oracle/README.md | 2 +- oracle/src/lib.rs | 4 ++-- payments/README.md | 2 +- payments/src/lib.rs | 6 +++--- payments/src/tests.rs | 8 ++++---- rate-limit/src/lib.rs | 14 +++++++------- scripts/run-clippy.sh | 2 +- tokens/src/lib.rs | 6 +++--- tokens/src/tests.rs | 4 ++-- traits/src/parameters.rs | 2 +- xtokens/src/lib.rs | 4 ++-- 12 files changed, 29 insertions(+), 29 deletions(-) diff --git a/authority/README.md b/authority/README.md index bc97f260d..aeba65978 100644 --- a/authority/README.md +++ b/authority/README.md @@ -2,10 +2,10 @@ ### Overview -Authority module to provide features for governance including dispatch method on behalf other accounts and schdule dispatchables. +Authority module to provide features for governance including dispatch method on behalf other accounts and schedule dispatchables. - `dispatch_as` can dispatch a dispatchable on behalf of other origin. -- `schedule_dispatch` can schdule a dispatchable to be dispatched at later block. +- `schedule_dispatch` can schedule a dispatchable to be dispatched at later block. - `fast_track_scheduled_dispatch` can fast track a scheduled dispatchable. - `delay_scheduled_dispatch` can delay a scheduled dispatchable. - `cancel_scheduled_dispatch` can cancel a scheduled dispatchable. diff --git a/oracle/README.md b/oracle/README.md index 4e05724d8..9e3cbc798 100644 --- a/oracle/README.md +++ b/oracle/README.md @@ -5,4 +5,4 @@ This module exposes capabilities for oracle operators to feed external offchain data. The raw values can be combined to provide an aggregated value. -The data is valid only if feeded by an authorized operator. This module implements `frame_support::traits::InitializeMembers` and `frame_support::traits::ChangeMembers`, to provide a way to manage operators membership. Typically it could be leveraged to `pallet_membership` in FRAME. +The data is valid only if fed by an authorized operator. This module implements `frame_support::traits::InitializeMembers` and `frame_support::traits::ChangeMembers`, to provide a way to manage operators membership. Typically it could be leveraged to `pallet_membership` in FRAME. diff --git a/oracle/src/lib.rs b/oracle/src/lib.rs index ce7ac3074..3c51dde96 100644 --- a/oracle/src/lib.rs +++ b/oracle/src/lib.rs @@ -11,7 +11,7 @@ //! offchain data. The raw values can be combined to provide an aggregated //! value. //! -//! The data is valid only if feeded by an authorized operator. +//! The data is valid only if fed by an authorized operator. //! `pallet_membership` in FRAME can be used to as source of `T::Members`. #![cfg_attr(not(feature = "std"), no_std)] @@ -130,7 +130,7 @@ pub mod module { pub enum Error { /// Sender does not have permission NoPermission, - /// Feeder has already feeded at this block + /// Feeder has already fed at this block AlreadyFeeded, } diff --git a/payments/README.md b/payments/README.md index 0d7612f0d..3ff96acd5 100644 --- a/payments/README.md +++ b/payments/README.md @@ -29,7 +29,7 @@ This pallet allows users to create secure reversible payments that keep funds lo - `pay` - Create an payment for the given currencyid/amount - `pay_with_remark` - Create a payment with a remark, can be used to tag payments -- `release` - Release the payment amount to recipent +- `release` - Release the payment amount to recipient - `cancel` - Allows the recipient to cancel the payment and release the payment amount to creator - `resolve_release_payment` - Allows assigned judge to release a payment - `resolve_cancel_payment` - Allows assigned judge to cancel a payment diff --git a/payments/src/lib.rs b/payments/src/lib.rs index 16cbe8c75..e9957cdc6 100644 --- a/payments/src/lib.rs +++ b/payments/src/lib.rs @@ -30,7 +30,7 @@ //! - `pay` - Create an payment for the given currencyid/amount //! - `pay_with_remark` - Create a payment with a remark, can be used to tag //! payments -//! - `release` - Release the payment amount to recipent +//! - `release` - Release the payment amount to recipient //! - `cancel` - Allows the recipient to cancel the payment and release the //! payment amount to creator //! - `resolve_release_payment` - Allows assigned judge to release a payment @@ -207,13 +207,13 @@ pub mod pallet { InvalidAction, /// Payment is in review state and cannot be modified PaymentNeedsReview, - /// Unexpeted math error + /// Unexpected math error MathError, /// Payment request has not been created RefundNotRequested, /// Dispute period has not passed DisputePeriodNotPassed, - /// The automatic cancelation queue cannot accept + /// The automatic cancellation queue cannot accept RefundQueueFull, } diff --git a/payments/src/tests.rs b/payments/src/tests.rs index ddd2bf7ab..2f96a370e 100644 --- a/payments/src/tests.rs +++ b/payments/src/tests.rs @@ -70,7 +70,7 @@ fn test_pay_works() { creator_initial_balance - payment_amount ); assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), 0); - // the transferred amount should be reserved in the recipent account + // the transferred amount should be reserved in the recipient account assert_eq!(Tokens::total_balance(CURRENCY_ID, &PAYMENT_RECIPENT), payment_amount); // the payment should not be overwritten @@ -133,7 +133,7 @@ fn test_cancel_works() { ); assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), 0); - // cancel should succeed when caller is the recipent + // cancel should succeed when caller is the recipient assert_ok!(Payment::cancel( RuntimeOrigin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR @@ -468,7 +468,7 @@ fn test_pay_with_remark_works() { creator_initial_balance - payment_amount ); assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), 0); - // the transferred amount should be reserved in the recipent account + // the transferred amount should be reserved in the recipient account assert_eq!(Tokens::total_balance(CURRENCY_ID, &PAYMENT_RECIPENT), payment_amount); // the payment should not be overwritten @@ -1019,7 +1019,7 @@ fn test_reserve_payment_amount_works() { creator_initial_balance - payment_amount ); assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), 0); - // the transferred amount should be reserved in the recipent account + // the transferred amount should be reserved in the recipient account assert_eq!(Tokens::total_balance(CURRENCY_ID, &PAYMENT_RECIPENT), payment_amount); // the payment should not be overwritten diff --git a/rate-limit/src/lib.rs b/rate-limit/src/lib.rs index 50d49dcbe..5c0193c9f 100644 --- a/rate-limit/src/lib.rs +++ b/rate-limit/src/lib.rs @@ -45,13 +45,13 @@ pub mod module { /// Limit rules type. #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub enum RateLimitRule { - /// Each period to reset remainer quota to `quota` amount. - /// `can_consume` check return true when the remainer quota gte the + /// Each period to reset remainder quota to `quota` amount. + /// `can_consume` check return true when the remainder quota gte the /// consume amount. PerPeriod { period: Period, quota: u128 }, - /// Each period to increase `quota_increment` amount to remainer quota - /// and keep remainer quota lte `max_quota`. - /// `can_consume` check return true when the remainer quota gte the + /// Each period to increase `quota_increment` amount to remainder quota + /// and keep remainder quota lte `max_quota`. + /// `can_consume` check return true when the remainder quota gte the /// consume amount. TokenBucket { period: Period, @@ -67,7 +67,7 @@ pub mod module { /// The maximum length of KeyFilter inner key. pub const MAX_FILTER_KEY_LENGTH: u32 = 256; - /// Match rules to fitler key is in bypass whitelist. + /// Match rules to filter key is in bypass whitelist. #[derive(PartialOrd, Ord, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)] pub enum KeyFilter { /// If the encoded key is equal to the vec, the key is in whitelist. @@ -442,7 +442,7 @@ pub mod module { match RateLimitRules::::get(limiter_id, &encoded_key) { Some(RateLimitRule::PerPeriod { .. }) | Some(RateLimitRule::TokenBucket { .. }) => { - // consume remainer quota in these situation. + // consume remainder quota in these situation. RateLimitQuota::::mutate(limiter_id, &encoded_key, |(_, remainer_quota)| { *remainer_quota = (*remainer_quota).saturating_sub(value); }); diff --git a/scripts/run-clippy.sh b/scripts/run-clippy.sh index e11fed87a..28719447d 100755 --- a/scripts/run-clippy.sh +++ b/scripts/run-clippy.sh @@ -5,7 +5,7 @@ set -e COMMAND=$1 ALLOW_CLIPPY_RULES=( - "clippy::identity_op" # this helps the code to be consistant + "clippy::identity_op" # this helps the code to be consistent "clippy::disallowed_names" # TODO: allow them in test only "clippy::ptr-arg" # TODO: decide if we want to fix those "clippy::match_single_binding" # TODO: fix those diff --git a/tokens/src/lib.rs b/tokens/src/lib.rs index 315effc5d..078c07c86 100644 --- a/tokens/src/lib.rs +++ b/tokens/src/lib.rs @@ -483,7 +483,7 @@ pub mod module { /// /// - `dest`: The recipient of the transfer. /// - `currency_id`: currency type. - /// - `amount`: free balance amount to tranfer. + /// - `amount`: free balance amount to transfer. #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::transfer())] pub fn transfer( @@ -551,7 +551,7 @@ pub mod module { /// /// - `dest`: The recipient of the transfer. /// - `currency_id`: currency type. - /// - `amount`: free balance amount to tranfer. + /// - `amount`: free balance amount to transfer. #[pallet::call_index(2)] #[pallet::weight(T::WeightInfo::transfer_keep_alive())] pub fn transfer_keep_alive( @@ -574,7 +574,7 @@ pub mod module { /// - `source`: The sender of the transfer. /// - `dest`: The recipient of the transfer. /// - `currency_id`: currency type. - /// - `amount`: free balance amount to tranfer. + /// - `amount`: free balance amount to transfer. #[pallet::call_index(3)] #[pallet::weight(T::WeightInfo::force_transfer())] pub fn force_transfer( diff --git a/tokens/src/tests.rs b/tokens/src/tests.rs index 458fe25e5..f042cf361 100644 --- a/tokens/src/tests.rs +++ b/tokens/src/tests.rs @@ -864,8 +864,8 @@ fn do_withdraw_report_keep_alive_error_when_ed_is_not_zero() { Error::::KeepAlive ); - // dave is in dust removal whitelist, still can withdraw if remainer is not zero - // but below ED. + // dave is in dust removal whitelist, still can withdraw if remainder is not + // zero but below ED. assert!(Accounts::::contains_key(DAVE, DOT)); assert_eq!(Tokens::free_balance(DOT, &DAVE), 100); assert_eq!(Tokens::total_issuance(DOT), 200); diff --git a/traits/src/parameters.rs b/traits/src/parameters.rs index e47c12489..04c1ad741 100644 --- a/traits/src/parameters.rs +++ b/traits/src/parameters.rs @@ -282,7 +282,7 @@ macro_rules! define_parameters { }; } -/// Define aggregrated parameters types. +/// Define aggregated parameters types. /// /// Example: /// ``` diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 877fb7277..ff43bcd08 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -182,7 +182,7 @@ pub mod module { DistinctReserveForAssetAndFee, /// The fee is zero. ZeroFee, - /// The transfering asset amount is zero. + /// The transferring asset amount is zero. ZeroAmount, /// The number of assets to be sent is over the maximum. TooManyAssetsBeingSent, @@ -495,7 +495,7 @@ pub mod module { assets.push((location, (*amount).into()).into()) } - // We construct the fee now, since getting it from assets wont work as assets + // We construct the fee now, since getting it from assets won't work as assets // sorts it let fee_location: Location = T::CurrencyIdConvert::convert(fee_currency_id.clone()) .ok_or(Error::::NotCrossChainTransferableCurrency)?; From 633f12e283568aa70997521a440c68fafd8a4472 Mon Sep 17 00:00:00 2001 From: zjb0807 Date: Fri, 7 Mar 2025 10:49:24 +0800 Subject: [PATCH 3/3] fix typo --- benchmarking/src/lib.rs | 4 ++-- payments/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarking/src/lib.rs b/benchmarking/src/lib.rs index d69559391..4d0db9d07 100644 --- a/benchmarking/src/lib.rs +++ b/benchmarking/src/lib.rs @@ -1172,7 +1172,7 @@ macro_rules! impl_benchmark_test_suite { $crate::BenchmarkError::Override(_) => { // This is still considered a success condition. $crate::log::error!( - "WARNING: benchmark error overrided - {}", + "WARNING: benchmark error overridden - {}", $crate::str::from_utf8(benchmark_name) .expect("benchmark name is always a valid string!"), ); @@ -1300,7 +1300,7 @@ macro_rules! add_benchmark { Err($crate::BenchmarkError::Override(mut result)) => { // Insert override warning as the first storage key. $crate::log::error!( - "WARNING: benchmark error overrided - {}", + "WARNING: benchmark error overridden - {}", $crate::str::from_utf8(benchmark) .expect("benchmark name is always a valid string!") ); diff --git a/payments/src/lib.rs b/payments/src/lib.rs index e9957cdc6..1d74b27c0 100644 --- a/payments/src/lib.rs +++ b/payments/src/lib.rs @@ -400,7 +400,7 @@ pub mod pallet { } /// Allow the creator of a payment to initiate a refund that will return - /// the funds after a configured amount of time that the reveiver has to + /// the funds after a configured amount of time that the receiver has to /// react and oppose the request #[pallet::call_index(4)] #[pallet::weight(T::WeightInfo::request_refund())]