Unverified Commit 9b7b92c1 authored by Michael Müller's avatar Michael Müller Committed by GitHub
Browse files

Enable `spellcheck` CI stage (#822)

* Enable `spellcheck` CI job

* Fix spellchecking mistakes

* Implement review suggestion

* Reword `>= 2`
parent e1486563
Pipeline #142848 passed with stages
in 29 minutes and 17 seconds
......@@ -22,7 +22,7 @@ use quote::{
quote_spanned,
};
/// Generator to create the ink! storage struct and important trait impls.
/// Generator to create the ink! storage struct and important trait implementations.
#[derive(From)]
pub struct TraitDefinition<'a> {
trait_def: &'a ir::InkTrait,
......
......@@ -36,7 +36,7 @@ pub struct AttributeArgs {
args: Punctuated<MetaNameValue, Token![,]>,
}
/// A name-value pair within an attribute, like feature = "nightly".
/// A name-value pair within an attribute, like `feature = "nightly"`.
///
/// The only difference from `syn::MetaNameValue` is that this additionally
/// allows the `value` to be a plain identifier or path.
......
......@@ -20,9 +20,9 @@
//! syntax.
//!
//! At the time of this writing we currently only use this for the argument
//! parsing of ink! config header `#[ink(env = my::env::Types, etc...)]` in order
//! to be able to parse identifiers in `name = value` segments for the `value`
//! part.
//! parsing of ink! configuration header `#[ink(env = my::env::Types, etc...)]`
//! in order to be able to parse identifiers in `name = value` segments for
//! the `value` part.
mod attr_args;
......
......@@ -382,7 +382,7 @@ pub enum AttributeArg {
/// This attribute supports a niche case that is rarely needed.
///
/// Can be applied on ink! implementation blocks in order to make ink! aware
/// of them. This is useful if such an implementation block doesn't contain
/// of them. This is useful if such an implementation block does not contain
/// any other ink! attributes, so it would be flagged by ink! as a Rust item.
/// Adding `#[ink(impl)]` on such implementation blocks makes them treated
/// as ink! implementation blocks thus allowing to access the environment
......@@ -966,7 +966,7 @@ mod tests {
mod test {
use crate::ir;
/// Mock for `ir::Attribute` to improve testability.
/// Mock for `ir::Attribute` to improve the ability to test.
#[derive(Debug, PartialEq, Eq)]
pub enum Attribute {
Ink(Vec<ir::AttributeArg>),
......@@ -996,7 +996,7 @@ mod tests {
}
}
/// Mock for `ir::InkAttribute` to improve testability.
/// Mock for `ir::InkAttribute` to improve the ability to test.
#[derive(Debug, PartialEq, Eq)]
pub struct InkAttribute {
args: Vec<ir::AttributeArg>,
......@@ -1027,7 +1027,7 @@ mod tests {
}
/// Asserts that the given [`syn::Attribute`] is converted into the expected
/// [`ir::Attribute]` or yields the expected error message.
/// [`ir::Attribute`] or yields the expected error message.
fn assert_attribute_try_from(
input: syn::Attribute,
expected: Result<test::Attribute, &'static str>,
......
......@@ -230,7 +230,7 @@ impl ChainExtension {
/// - If the input trait is an automatically implemented trait (`auto trait`).
/// - If the input trait is generic over some set of types.
/// - If the input trait's visibility is not public (`pub`).
/// - If the input trait has supertraits.
/// - If the input trait has super-traits.
fn analyse_properties(item_trait: &syn::ItemTrait) -> Result<()> {
if let Some(unsafety) = &item_trait.unsafety {
return Err(format_err_spanned!(
......@@ -259,7 +259,7 @@ impl ChainExtension {
if !item_trait.supertraits.is_empty() {
return Err(format_err_spanned!(
item_trait.supertraits,
"ink! chain extensions with supertraits are not supported, yet"
"ink! chain extensions with super-traits are not supported, yet"
))
}
Ok(())
......@@ -326,7 +326,7 @@ impl ChainExtension {
/// - associated constants (`const`)
/// - associated types (`type`)
/// - macros definitions or usages
/// - unknown token sequences (verbatims)
/// - unknown token sequences (`Verbatim`'s)
/// - methods with default implementations
/// - If the trait contains methods which do not respect the ink! trait definition requirements:
/// - All trait methods must not have a `self` receiver.
......@@ -569,7 +569,7 @@ mod tests {
#[test]
fn chain_extension_with_supertraits_is_denied() {
assert_ink_chain_extension_eq_err!(
error: "ink! chain extensions with supertraits are not supported, yet",
error: "ink! chain extensions with super-traits are not supported, yet",
pub trait MyChainExtension: SuperChainExtension {}
);
}
......
......@@ -40,7 +40,7 @@ pub struct Config {
env: Option<Environment>,
}
/// Return an error to notify about duplicate ink! config arguments.
/// Return an error to notify about duplicate ink! configuration arguments.
fn duplicate_config_err<F, S>(fst: F, snd: S, name: &str) -> syn::Error
where
F: Spanned,
......@@ -79,7 +79,7 @@ impl TryFrom<ast::AttributeArgs> for Config {
} else {
return Err(format_err_spanned!(
arg,
"expected a bool literal for `dynamic_storage_allocator` ink! config argument",
"expected a bool literal for `dynamic_storage_allocator` ink! configuration argument",
))
}
} else if arg.name.is_ident("compile_as_dependency") {
......@@ -91,7 +91,7 @@ impl TryFrom<ast::AttributeArgs> for Config {
} else {
return Err(format_err_spanned!(
arg,
"expected a bool literal for `compile_as_dependency` ink! config argument",
"expected a bool literal for `compile_as_dependency` ink! configuration argument",
))
}
} else if arg.name.is_ident("env") {
......@@ -103,13 +103,13 @@ impl TryFrom<ast::AttributeArgs> for Config {
} else {
return Err(format_err_spanned!(
arg,
"expected a path for `env` ink! config argument",
"expected a path for `env` ink! configuration argument",
))
}
} else {
return Err(format_err_spanned!(
arg,
"encountered unknown or unsupported ink! config argument",
"encountered unknown or unsupported ink! configuration argument",
))
}
}
......@@ -206,7 +206,7 @@ mod tests {
fn storage_alloc_invalid_value_fails() {
assert_try_from(
syn::parse_quote! { dynamic_storage_allocator = "invalid" },
Err("expected a bool literal for `dynamic_storage_allocator` ink! config argument"),
Err("expected a bool literal for `dynamic_storage_allocator` ink! configuration argument"),
)
}
......@@ -229,7 +229,7 @@ mod tests {
assert_try_from(
syn::parse_quote! { compile_as_dependency = "invalid" },
Err(
"expected a bool literal for `compile_as_dependency` ink! config argument"
"expected a bool literal for `compile_as_dependency` ink! configuration argument"
)
)
}
......@@ -254,7 +254,7 @@ mod tests {
fn env_invalid_value_fails() {
assert_try_from(
syn::parse_quote! { env = "invalid" },
Err("expected a path for `env` ink! config argument"),
Err("expected a path for `env` ink! configuration argument"),
);
}
......@@ -262,7 +262,7 @@ mod tests {
fn unknown_arg_fails() {
assert_try_from(
syn::parse_quote! { unknown = argument },
Err("encountered unknown or unsupported ink! config argument"),
Err("encountered unknown or unsupported ink! configuration argument"),
);
}
......
......@@ -91,7 +91,7 @@ impl TryFrom<syn::Item> for Item {
return Ok(Self::Rust(item_impl.into()))
}
// At this point we know that there must be at least one ink!
// attribute on either the impl block itself or one of its items.
// attribute on either the `impl` block itself or one of its items.
<ir::ItemImpl as TryFrom<_>>::try_from(item_impl)
.map(Into::into)
.map(Self::Ink)
......
......@@ -120,7 +120,7 @@ impl Storage {
&self.ast.ident
}
/// Returns an iter yielding all fields of the storage struct.
/// Returns an iterator yielding all fields of the storage struct.
pub fn fields(&self) -> syn::punctuated::Iter<syn::Field> {
self.ast.fields.iter()
}
......
......@@ -69,7 +69,7 @@ impl<'a, C> CallableWithSelector<'a, C>
where
C: Callable,
{
/// Creates a new wrapper around the given callable and parent impl block.
/// Creates a new wrapper around the given callable and parent `impl` block.
pub(super) fn new(item_impl: &'a ir::ItemImpl, callable: &'a C) -> Self {
Self {
composed_selector: compose_selector(item_impl, callable),
......@@ -80,7 +80,7 @@ where
}
impl<'a, C> CallableWithSelector<'a, C> {
/// Returns the composed selector of the ink! callable the the impl block.
/// Returns the composed selector of the ink! callable the the `impl` block.
pub fn composed_selector(&self) -> ir::Selector {
self.composed_selector
}
......@@ -184,13 +184,13 @@ pub trait Callable {
/// Given
/// - the callable's identifier `i`
/// - the optionally set callable's selector `s`
/// - the impl blocks trait path in case it implements a trait, `P`
/// - the impl blocks optional user provided namespace `S`
/// - the `impl` blocks trait path in case it implements a trait, `P`
/// - 16 kB blocks optional user provided namespace `S`
///
/// Then the selector is composed in the following way:
///
/// - If `s` is given we simply return `s`.
/// - Otherwise if `T` is not `None` (trait impl block) we concatenate
/// - Otherwise if `T` is not `None` (trait `impl` block) we concatenate
/// `S`, `T` and `i` with `::` as separator if `T` refers to a full-path.
/// If `T` refers to a relative path or is just an identifier we only take
/// its last segment `p` (e.g. the trait's identifier) into consideration
......@@ -293,7 +293,7 @@ pub trait Callable {
/// wherever possible; OR import the trait and use only its identifier with
/// an additional namespace if required to disambiguate selectors.
/// - Try not to intermix the above recommendations.
/// - Avoid directly setting the selector of an ink! message or constuctor.
/// - Avoid directly setting the selector of an ink! message or constructor.
/// Only do this if nothing else helps and you need a very specific selector,
/// e.g. in case of backwards compatibility.
/// - Do not use the namespace unless required to disambiguate.
......@@ -353,11 +353,11 @@ where
/// In case any of the common externally callable invariants are not met:
/// - This is `true` if the externally callable is:
/// - generic
/// - const (compile-time evaluatable)
/// - async (async WebAssembly smart contract calling is not allowed)
/// - unsafe (caller provided assertions not yet stable)
/// - `const` (compile-time evaluable)
/// - `async` (asynchronous WebAssembly smart contract calling is not allowed)
/// - `unsafe` (caller provided assertions not yet stable)
/// - Furthermore this is `true` if the externally callable is defined for a
/// non default ABI (e.g. `extern "C"`) or doesn't have valid visibility.
/// non default ABI (e.g. `extern "C"`) or does not have valid visibility.
pub(super) fn ensure_callable_invariants(
method_item: &syn::ImplItemMethod,
kind: CallableKind,
......
......@@ -33,7 +33,7 @@ use syn::spanned::Spanned as _;
///
/// # Note
///
/// Based on [`syn::ImplItem`] with special variants for ink! impl items.
/// Based on [`syn::ImplItem`] with special variants for ink! `impl` items.
#[derive(Debug, PartialEq, Eq)]
#[allow(clippy::large_enum_variant)]
pub enum ImplItem {
......@@ -87,7 +87,7 @@ impl TryFrom<syn::ImplItem> for ImplItem {
}
}
other_item => {
// This is an error if the impl item contains any unexpected
// This is an error if the `impl` item contains any unexpected
// ink! attributes. Otherwise it is a normal Rust item.
if ir::contains_ink_attributes(other_item.attrs()) {
let (ink_attrs, _) =
......@@ -108,7 +108,7 @@ impl TryFrom<syn::ImplItem> for ImplItem {
}
impl ImplItem {
/// Returns `true` if the impl block item is an ink! message.
/// Returns `true` if the `impl` block item is an ink! message.
pub fn is_message(&self) -> bool {
self.filter_map_message().is_some()
}
......@@ -123,7 +123,7 @@ impl ImplItem {
}
}
/// Returns `true` if the impl block item is an ink! message.
/// Returns `true` if the `impl` block item is an ink! message.
pub fn is_constructor(&self) -> bool {
self.filter_map_constructor().is_some()
}
......@@ -138,7 +138,7 @@ impl ImplItem {
}
}
/// Returns `true` if the impl block item is a non ink! specific item.
/// Returns `true` if the `impl` block item is a non ink! specific item.
pub fn is_other_item(&self) -> bool {
self.filter_map_other_item().is_some()
}
......
......@@ -121,7 +121,7 @@ impl ItemImpl {
///
/// This is the case if:
///
/// - The ink! implementation block has been annotatated as in:
/// - The ink! implementation block has been annotated as in:
///
/// ```
/// # use core::convert::TryFrom;
......@@ -218,7 +218,7 @@ impl TryFrom<syn::ItemImpl> for ItemImpl {
if !Self::is_ink_impl_block(&item_impl)? {
return Err(format_err_spanned!(
item_impl,
"missing ink! annotations on the impl block or on any of its items"
"missing ink! annotations on 16 kB block or on any of its items"
))
}
if let Some(defaultness) = item_impl.defaultness {
......@@ -247,7 +247,7 @@ impl TryFrom<syn::ItemImpl> for ItemImpl {
let is_trait_impl = item_impl.trait_.is_some();
for impl_item in &impl_items {
/// Ensures that visibility of ink! messages and constructors is
/// valid in dependency of the containing ink! impl block.
/// valid in dependency of the containing ink! `impl` block.
///
/// # Note
///
......@@ -366,7 +366,7 @@ impl ItemImpl {
IterConstructors::new(self)
}
/// Returns a slice over the shared references of the items of the impl.
/// Returns a slice over the shared references of the items of the `impl`.
pub fn items(&self) -> &[ir::ImplItem] {
&self.items
}
......
......@@ -343,7 +343,7 @@ impl InkTrait {
if !item_trait.supertraits.is_empty() {
return Err(format_err_spanned!(
item_trait.supertraits,
"ink! trait definitions with supertraits are not supported, yet"
"ink! trait definitions with super-traits are not supported, yet"
))
}
Ok(())
......@@ -357,7 +357,7 @@ impl InkTrait {
/// - associated constants (`const`)
/// - associated types (`type`)
/// - macros definitions or usages
/// - unknown token sequences (verbatims)
/// - unknown token sequences (`Verbatim`'s)
/// - methods with default implementations
/// - If the trait contains methods which do not respect the ink! trait definition requirements:
/// - All trait methods need to be declared as either `#[ink(message)]` or `#[ink(constructor)]`
......@@ -635,7 +635,7 @@ mod tests {
#[test]
fn trait_def_with_supertraits_is_denied() {
assert_ink_trait_eq_err!(
error: "ink! trait definitions with supertraits are not supported, yet",
error: "ink! trait definitions with super-traits are not supported, yet",
pub trait MyTrait: SuperTrait {}
);
}
......
......@@ -23,7 +23,7 @@
//!
//! The ink! IR tries to stay close to the original Rust syntactic structure.
//! All ink! definitions of an ink! smart contract are always defined within
//! a so-called Rust inline modlue (`mod my_module { ... items ... }`).
//! a so-called Rust inline module (`mod my_module { ... items ... }`).
//! Therefore all ink! definition are found and accessed using the
//! [`ItemMod`](`crate::ir::ItemMod`) data structure.
......
......@@ -37,7 +37,7 @@ use proc_macro::TokenStream;
///
/// ink! smart contracts can compile in several different modes.
/// There are two main compilation models using either
/// - on-chain mode: `no_std` + WebAssembly as target
/// - on-chain mode: `no_std` and WebAssembly as target
/// - off-chain mode: `std`
///
/// We generally use the on-chain mode for actual smart contract deployment
......@@ -59,7 +59,7 @@ use proc_macro::TokenStream;
/// - `false`: Do NOT use the dynamic storage allocator provided by ink!.
///
/// This feature is generally only needed for smart contracts that try to model
/// their data in a way that contains storage entites within other storage
/// their data in a way that contains storage entities within other storage
/// entities.
///
/// Contract writers should try to write smart contracts that do not depend on the
......@@ -189,7 +189,7 @@ use proc_macro::TokenStream;
///
/// **Default value:** `DefaultEnvironment` defined in `ink_env` crate.
///
/// ## Anaylsis
/// ## Analysis
///
/// The `#[ink::contract]` macro fully analyses its input smart contract
/// against invalid arguments and structure.
......@@ -379,7 +379,7 @@ use proc_macro::TokenStream;
///
/// ## Interacting with the Contract Executor
///
/// The `ink_env` crate provides facitilies to interact with the contract executor that
/// The `ink_env` crate provides facilities to interact with the contract executor that
/// connects ink! smart contracts with the outer world.
///
/// For example it is possible to query the current call's caller via:
......@@ -649,9 +649,9 @@ pub fn test(attr: TokenStream, item: TokenStream) -> TokenStream {
/// The methods are defined as associated trait methods without implementation.
///
/// Chain extension methods must not have a `self` receiver such as `&self` or `&mut self`
/// and must have inputs and output that implement SCALE codec. Their return value follows
/// specific rules that can be altered using the `handle_status` and `returns_result` attributes
/// which are described in more detail below.
/// and must have inputs and output that implement the SCALE encoding and decoding.
/// Their return value follows specific rules that can be altered using the `handle_status`
/// and `returns_result` attributes which are described in more detail below.
///
/// # Usage
///
......@@ -726,7 +726,7 @@ pub fn test(attr: TokenStream, item: TokenStream) -> TokenStream {
/// Note that if a chain extension method is attributed with `returns_result = false`
/// and with `handle_status = true` it will still return a value of type `Result<T, Self::ErrorCode>`.
///
/// ## Usage: `handle_status` + `returns_result`
/// ## Usage: `handle_status` and `returns_result`
///
/// Use both `handle_status = false` and `returns_result = false` for the same chain extension method
/// if a call to it may never fail and never returns a `Result` type.
......@@ -738,10 +738,10 @@ pub fn test(attr: TokenStream, item: TokenStream) -> TokenStream {
///
/// | `handle_status` | `returns_result` | Effects |
/// |:---------------:|:----------------:|:--------|
/// |`true` |`true` | The chain extension method is required to return a value of type `Result<T, E>` where `E: From<Self::ErrorCode>`. A call will always check if the returned status code indicates success and only then will load and decode the value in the output buffer. |
/// |`true` |`false`| The chain extension method may return any non-`Result` type. A call will always check if the returned status code indicates success and only then will load and decode the value in the output buffer. The actual return type of the chain extension method is still `Result<T, Self::ErrorCode>` when the chain extension method was defined to return a value of type `T`. |
/// |`false`|`true` | The chain extension method is required to return a value of type `Result<T, E>`. A call will always assume that the returned status code indicates success and therefore always load and decode the output buffer directly. |
/// |`false`|`false`| The chain extension method may return any non-`Result` type. A call will always assume that the returned status code indicates success and therefore always load and decode the output buffer directly. |
/// | `true` | `true` | The chain extension method is required to return a value of type `Result<T, E>` where `E: From<Self::ErrorCode>`. A call will always check if the returned status code indicates success and only then will load and decode the value in the output buffer. |
/// | `true` | `false` | The chain extension method may return any non-`Result` type. A call will always check if the returned status code indicates success and only then will load and decode the value in the output buffer. The actual return type of the chain extension method is still `Result<T, Self::ErrorCode>` when the chain extension method was defined to return a value of type `T`. |
/// | `false` | `true` | The chain extension method is required to return a value of type `Result<T, E>`. A call will always assume that the returned status code indicates success and therefore always load and decode the output buffer directly. |
/// | `false` | `false` | The chain extension method may return any non-`Result` type. A call will always assume that the returned status code indicates success and therefore always load and decode the output buffer directly. |
///
/// # Error Code
///
......
error: expected a bool literal for `dynamic_storage_allocator` ink! config argument
error: expected a bool literal for `dynamic_storage_allocator` ink! configuration argument
--> $DIR/H-01-invalid-dyn-alloc.rs:3:17
|
3 | #[ink::contract(dynamic_storage_allocator = "foo")]
......
error: expected a bool literal for `compile_as_dependency` ink! config argument
error: expected a bool literal for `compile_as_dependency` ink! configuration argument
--> $DIR/H-02-invalid-as-dependency.rs:3:17
|
3 | #[ink::contract(compile_as_dependency = "yes")]
......
......@@ -5,7 +5,7 @@ mod multiple_storage_structs {
#[ink(storage)]
pub struct FirstStorageStruct {}
// ink! currently doesn't allow for multiple #[ink(storage)] structs
// ink! currently does not allow for multiple #[ink(storage)] structs
#[ink(storage)]
pub struct SecondStorageStruct {}
......
......@@ -2,13 +2,13 @@ use ink_lang as ink;
#[ink::contract]
mod non_storage_ink_impls {
// This test ensures that ink! impl blocks are always
// This test ensures that ink! `impl` blocks are always
// implemented on the only storage struct definition.
#[ink(storage)]
pub struct StorageStruct {}
// This ink! impl block is okay.
// This ink! `impl` block is okay.
impl StorageStruct {
#[ink(constructor)]
pub fn constructor1() -> Self {
......@@ -19,10 +19,10 @@ mod non_storage_ink_impls {
pub fn message1(&self) {}
}
// Missing the #[ink(storage)] attribute on purpose.
// Missing the `#[ink(storage)]` attribute on purpose.
pub struct NonStorageStruct {}
// This ink! impl block is invalid in that it implements
// This ink! `impl` block is invalid in that it implements
// the messages and constructors for a non-existing ink!
// storage struct. We expect a failure here.
impl NonStorageStruct {
......
......@@ -195,11 +195,11 @@ where
///
/// # Parameters
///
/// - `at_refcount`: The refcount assumed for the returned `custom_refcount_*` fields.
/// - `at_refcount`: The `refcount` assumed for the returned `custom_refcount_*` fields.
/// If `None` is supplied the `custom_refcount_*` fields will also be `None`.
///
/// The `current_*` fields of `RentStatus` do **not** consider changes to the code's
/// refcount made during the currently running call.
/// `refcount` made during the currently running call.
///
/// # Note
///
......
......@@ -446,7 +446,7 @@ fn push_largest_value_complexity_big_o_log_n() -> ink_env::Result<()> {
const CONST_READS: usize = 5;
// 1 elements.len + 1 cell which was pushed to
// vec.len doesn't get larger because no cell is added
// vec.len does not get larger because no cell is added
const CONST_WRITES: usize = 2;
for (n, log_n) in &[(2, 1), (4, 2), (8, 3), (16, 4), (32, 5), (64, 6)] {
......@@ -472,7 +472,7 @@ fn push_smallest_value_complexity_big_o_1() -> ink_env::Result<()> {
const EXPECTED_READS: usize = 6;
// binary heap len + one cell
// vec.len doesn't get larger because no cell is added
// vec.len does not get larger because no cell is added
const EXPECTED_WRITES: usize = 2;
for n in &[2, 4, 8, 16, 32, 64] {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment