Skip to content

Commit

Permalink
chore: add typo checker in ci (#1159)
Browse files Browse the repository at this point in the history
  • Loading branch information
tabVersion committed Mar 28, 2024
1 parent c87582f commit 053aa5b
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 11 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/typo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Typo Checker
on: [pull_request]

jobs:
run:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v2
- name: Check spelling of the entire repository
uses: crate-ci/typos@v1.11.1

1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[default.extend-words]
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ Get your fully configured development environment in under 1 minute using [GitHu
* Move type aliases and core types to near-sdk to avoid coupling. [PR 415](https://github.com/near/near-sdk-rs/pull/415).
* Implements new `Lazy` type under the new `unstable` feature which is a lazily loaded storage value. [PR 409](https://github.com/near/near-sdk-rs/pull/409).
* fix(promise): `PromiseOrValue` now correctly sets `should_return` flag correctly on serialization. [PR 407](https://github.com/near/near-sdk-rs/pull/407).
* fix(tree_map): Correctly panic when range indices are exluded and `start > end`. [PR 392](https://github.com/near/near-sdk-rs/pull/392).
* fix(tree_map): Correctly panic when range indices are excluded and `start > end`. [PR 392](https://github.com/near/near-sdk-rs/pull/392).
* Implement `FromStr` for json types to allow calling `.parse()` to convert them.
* `ValidAccountId` [PR 391](https://github.com/near/near-sdk-rs/pull/391).
* `Base58CryptoHash` [PR 398](https://github.com/near/near-sdk-rs/pull/398).
Expand All @@ -338,7 +338,7 @@ Get your fully configured development environment in under 1 minute using [GitHu
* Update syscall interface to no longer go through `BLOCKCHAIN_INTERFACE`. Instead uses `near_sdk::sys` which is under the `unstable` feature flag if needed. [PR 417](https://github.com/near/near-sdk-rs/pull/417).
* Set up global allocator by default for WASM architectures. [PR 429](https://github.com/near/near-sdk-rs/pull/429).
* This removes the re-export of `wee_alloc` because if this feature is enabled, the allocator will already be set.
* Deprecates `setup_alloc!` macro as this will be setup by default, as long as the `wee_alloc` feature is not specifically disabled. In this case, the allocator can be overriden to a custom one or set manually if intended.
* Deprecates `setup_alloc!` macro as this will be setup by default, as long as the `wee_alloc` feature is not specifically disabled. In this case, the allocator can be overridden to a custom one or set manually if intended.
* Update `TreeMap` iterator implementation to avoid unnecessary storage reads. [PR 428](https://github.com/near/near-sdk-rs/pull/428).
* Update `AccountId` to be a newtype with merged functionality from `ValidAccountId`. [PR 448](https://github.com/near/near-sdk-rs/pull/448)
* Removes `ValidAccountId` to avoid having multiple types for account IDs.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub struct StatusMessage {
```

### Payable methods
We can allow methods to accept token transfer together with the function call. This is done so that contracts can define a fee in tokens that needs to be payed when they are used. By the default the methods are not payable and they will panic if someone will attempt to transfer tokens to them during the invocation. This is done for safety reason, in case someone accidentally transfers tokens during the function call.
We can allow methods to accept token transfer together with the function call. This is done so that contracts can define a fee in tokens that needs to be paid when they are used. By the default the methods are not payable and they will panic if someone will attempt to transfer tokens to them during the invocation. This is done for safety reason, in case someone accidentally transfers tokens during the function call.

To declare a payable method simply use `#[payable]` decorator:
```rust
Expand Down
4 changes: 2 additions & 2 deletions examples/fungible-token/tests/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ async fn test_storage_deposit_refunds_excessive_deposit() -> anyhow::Result<()>
assert_eq!(storage_balance_bounds.min, minimal_deposit.as_yoctonear().into());
assert_eq!(storage_balance_bounds.max, minimal_deposit.as_yoctonear().into());

// Check that a non-registerred account does not have storage balance
// Check that a non-registered account does not have storage balance
//
#[derive(near_sdk::serde::Serialize, near_sdk::serde::Deserialize)]
#[serde(crate = "near_sdk::serde")]
Expand All @@ -190,7 +190,7 @@ async fn test_storage_deposit_refunds_excessive_deposit() -> anyhow::Result<()>
}
let storage_balance_bounds: Option<StorageBalanceOf> = contract
.call("storage_balance_of")
.args_json(near_sdk::serde_json::json!({"account_id": "non-registerred-account"}))
.args_json(near_sdk::serde_json::json!({"account_id": "non-registered-account"}))
.view()
.await?
.json()?;
Expand Down
2 changes: 1 addition & 1 deletion examples/status-message/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ mod tests {
testing_env!(context);
let mut contract = StatusMessage::default();
contract.set_status("hello".to_string());
// Flush the pending changes to avoid panic in the view method below due to the pending non-commited changes to the `store::LookupMap`:
// Flush the pending changes to avoid panic in the view method below due to the pending non-committed changes to the `store::LookupMap`:
// HostError(ProhibitedInView { method_name: "storage_write" })
contract.records.flush();
assert_eq!(get_logs(), vec!["bob_near set_status with message hello"]);
Expand Down
2 changes: 1 addition & 1 deletion near-sdk-macros/src/core_impl/contract_metadata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl ContractMetadata {
}
}

/// Allows for the injection of the contract source metadata infomation into the contract code as
/// Allows for the injection of the contract source metadata information into the contract code as
/// a constant.
pub(crate) fn contract_source_metadata_const(attr: proc_macro::TokenStream) -> TokenStream {
if attr.to_string().is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion near-sdk-macros/src/core_impl/info_extractor/arg_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct ArgInfo {
pub bindgen_ty: BindgenArgType,
/// Type of serializer that we use for this argument.
pub serializer_ty: SerializerType,
/// Spans of all occurences of the `Self` token, if any.
/// Spans of all occurrences of the `Self` token, if any.
pub self_occurrences: Vec<Span>,
/// The original `PatType` of the argument.
pub original: PatType,
Expand Down
2 changes: 1 addition & 1 deletion near-sdk/compilation_tests/function_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct ErrorStruct {

impl fmt::Display for ErrorStruct {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "error ocurred: {}", self.message)
write!(f, "error occurred: {}", self.message)
}
}

Expand Down
2 changes: 1 addition & 1 deletion near-sdk/src/collections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//! ```
//!
//! The efficiency of `LookupMap` comes at the cost, since it has fewer methods than `HashMap` and is not
//! that seemlessly integrated with the rest of the Rust standard library.
//! that seamlessly integrated with the rest of the Rust standard library.

mod legacy_tree_map;
#[allow(deprecated)]
Expand Down
2 changes: 1 addition & 1 deletion near-sdk/src/store/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ where
self.len == 0
}

/// Create new vector with zero elements. Prefixes storage accesss with the prefix provided.
/// Create new vector with zero elements. Prefixes storage access with the prefix provided.
///
/// This prefix can be anything that implements [`IntoStorageKey`]. The prefix is used when
/// storing and looking up values in storage to ensure no collisions with other collections.
Expand Down

0 comments on commit 053aa5b

Please sign in to comment.