Skip to content

add codespell workflow #1021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,Cargo.lock
count =
quiet-level = 3
ignore-words = ./.codespell/ignore.txt
Empty file added .codespell/ignore.txt
Empty file.
1 change: 1 addition & 0 deletions .codespell/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
codespell==2.4.1
33 changes: 33 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions authority/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!"),
);
Expand Down Expand Up @@ -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!")
);
Expand Down
2 changes: 1 addition & 1 deletion oracle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions oracle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -130,7 +130,7 @@ pub mod module {
pub enum Error<T, I = ()> {
/// Sender does not have permission
NoPermission,
/// Feeder has already feeded at this block
/// Feeder has already fed at this block
AlreadyFeeded,
}

Expand Down
2 changes: 1 addition & 1 deletion payments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions payments/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}

Expand Down Expand Up @@ -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())]
Expand Down
8 changes: 4 additions & 4 deletions payments/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions rate-limit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -442,7 +442,7 @@ pub mod module {

match RateLimitRules::<T>::get(limiter_id, &encoded_key) {
Some(RateLimitRule::PerPeriod { .. }) | Some(RateLimitRule::TokenBucket { .. }) => {
// consume remainer quota in these situation.
// consume remainder quota in these situation.
RateLimitQuota::<T>::mutate(limiter_id, &encoded_key, |(_, remainer_quota)| {
*remainer_quota = (*remainer_quota).saturating_sub(value);
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tokens/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions tokens/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,8 +864,8 @@ fn do_withdraw_report_keep_alive_error_when_ed_is_not_zero() {
Error::<Runtime>::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::<Runtime>::contains_key(DAVE, DOT));
assert_eq!(Tokens::free_balance(DOT, &DAVE), 100);
assert_eq!(Tokens::total_issuance(DOT), 200);
Expand Down
2 changes: 1 addition & 1 deletion traits/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ macro_rules! define_parameters {
};
}

/// Define aggregrated parameters types.
/// Define aggregated parameters types.
///
/// Example:
/// ```
Expand Down
4 changes: 2 additions & 2 deletions xtokens/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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::<T>::NotCrossChainTransferableCurrency)?;
Expand Down