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

Add automated spell-checking (#718)



* Add `.config`

* Fix hunspell complaints

* Run spellcheck in CI

* Improve hunspell config

* Fix 'pre' prefix

* Remove `|` from dictionary

* Add missing words to dictionary

* Add missing words to dictionary

* Add missing words to dictionary

* Fix `n`-th → nth

* Fix indentation

* Remove comment

* Fix number

* Fix spacing

* Remove regex

* Apply suggestions from code review
Co-authored-by: default avatarBernhard Schuster <bernhard@ahoi.io>

* Fix dictionary

* Fix dictionary

* Implement review comments

* Replace SRML with FRAME

* Replace occurrences of 'spreaded'

* Tuning text regarding 'spreaded'

* Update crates/storage/src/lazy/entry.rs
Co-authored-by: default avatarHero Bird <robin.freyler@gmail.com>
Co-authored-by: default avatarBernhard Schuster <bernhard@ahoi.io>
Co-authored-by: default avatarHero Bird <robin.freyler@gmail.com>
parent f329a928
Pipeline #129415 failed with stages
in 7 minutes and 28 seconds
60
WebAssembly
Wasm
validator
ERC
fuzzer
SHA
BLAKE2
KECCAK
ABI
FFI
UI
crypto
deploy
layed
dispatchable
encodable
decodable
callee
prefilled
defrag
defragmentation
growable
codegen
deallocate
deallocation
getter
bitvector
dereferencing
recurse
kb
scalability
scalable
adjunctive
invariants
deserializes
hasher/S
hashmap/S
vector/S
vec/S
enum/S
struct/S
instantiation/S
allocator/S
defragment/SD
layout/JG
endian/P
accessor/S
[Hunspell]
lang = "en_US"
search_dirs = ["."]
extra_dictionaries = ["cargo_spellcheck.dic"]
[Hunspell.quirks]
allow_concatenation = true
allow_dashes = true
......@@ -141,6 +141,12 @@ docs:
-p ink_lang -p ink_lang_macro -p ink_lang_ir -p ink_lang_codegen
- mv ${CARGO_TARGET_DIR}/doc ./crate-docs
spellcheck:
stage: workspace
<<: *docker-env
script:
- cargo spellcheck check --cfg=.config/cargo_spellcheck.toml --checkers hunspell --code 1
codecov:
stage: workspace
<<: *docker-env
......
......@@ -222,7 +222,7 @@ See e.g. the [`examples/trait-erc20`](https://github.com/paritytech/ink/blob/mas
### Off-chain Testing
The `#[ink::test]` proc. macro enables off-chain testing. See e.g. the [`examples/erc20`](https://github.com/paritytech/ink/blob/master/examples/erc20/lib.rs#L278-L280) contract on how to utilize those or [the documentation](https://paritytech.github.io/ink/ink_lang/attr.test.html) for details.
The `#[ink::test]` procedural macro enables off-chain testing. See e.g. the [`examples/erc20`](https://github.com/paritytech/ink/blob/master/examples/erc20/lib.rs#L278-L280) contract on how to utilize those or [the documentation](https://paritytech.github.io/ink/ink_lang/attr.test.html) for details.
## Developer Documentation
......
......@@ -22,7 +22,7 @@ ink! 3.0-rc3 is compatible with
## Changed
- Migrate `ink_storage::SmallVec` and `ink_storage::lazy::SmallLazyArray` to use `min_const_generics`.
- The `min_const_generics` feature is going to be stabilized in Rust 1.51. For now it was put behind
- The `min_const_generics` feature is going to be stabilized in Rust 1.51. For now it was put behind
the `ink-unstable` crate feature of the `ink_storage` crate.
- Improve error reporting for conflicting ink! attributes.
- Improve error reporting for invalid constructor or message selector. (https://github.com/paritytech/ink/pull/561)
......@@ -436,7 +436,7 @@ pub fn transfer(&mut self, from: AccountId, to: AccountId, value: Balance) -> Re
## Trait Support
One of the most anticipated features of ink! 3.0 is its Rust trait support.
Through the new `#[ink::trait_definition]` proc. macro it is now possible to define your very own trait definitions that are then implementable by ink! smart contracts.
Through the new `#[ink::trait_definition]` procedural macro it is now possible to define your very own trait definitions that are then implementable by ink! smart contracts.
This allows to define shared smart contract interfaces to different concrete implementations.
Note that this ink! trait definition can be defined anywhere, even in another crate!
......
......@@ -14,7 +14,7 @@
//! Crate providing `WEE_ALLOC` support for all Wasm compilations of ink! smart contract.
//!
//! The Wee allocator is an allocator specifically designed to have a low footprint albeith
//! The Wee allocator is an allocator specifically designed to have a low footprint albeit
//! being less efficient for allocation and deallocation operations.
#![cfg_attr(not(feature = "std"), no_std)]
......
......@@ -36,7 +36,7 @@ blake2 = { version = "0.9", optional = true }
# Only used in the off-chain environment.
#
# Sadly couldn't be marked as dev-dependency.
# Never use this crate outside of the off-chain environment!
# Never use this crate outside the off-chain environment!
rand = { version = "0.8", default-features = false, features = ["alloc"], optional = true }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
......
......@@ -371,7 +371,7 @@ where
///
/// # Note
///
/// - The `filtered_keys` can be used to ignore certain storage regions
/// - `filtered_keys` can be used to ignore certain storage regions
/// in the restorer contract to not influence the hash calculations.
/// - Does *not* perform restoration right away but defers it to the end of
/// the contract execution.
......@@ -405,7 +405,7 @@ pub fn restore_contract<T>(
///
/// This function never returns. Either the termination was successful and the
/// execution of the destroyed contract is halted. Or it failed during the termination
/// which is considered fatal and results in a trap + rollback.
/// which is considered fatal and results in a trap and rollback.
pub fn terminate_contract<T>(beneficiary: T::AccountId) -> !
where
T: Environment,
......@@ -426,7 +426,7 @@ where
/// # Errors
///
/// - If the contract doesn't have sufficient funds.
/// - If the transfer would have brought the sender's total balance below the
/// - If the transfer had brought the sender's total balance below the
/// subsistence threshold.
pub fn transfer<T>(destination: T::AccountId, value: T::Balance) -> Result<()>
where
......@@ -449,8 +449,8 @@ where
/// # Usage
///
/// Normally contracts define their own `enum` dispatch types respective
/// to their exported contructors and messages that implement `scale::Decode`
/// according to the contructors or messages selectors and their arguments.
/// to their exported constructors and messages that implement `scale::Decode`
/// according to the constructors or messages selectors and their arguments.
/// These `enum` dispatch types are then given to this procedure as the `T`.
///
/// When using ink! users do not have to construct those enum dispatch types
......
......@@ -86,8 +86,8 @@ pub trait EnvBackend {
/// # Usage
///
/// Normally contracts define their own `enum` dispatch types respective
/// to their exported contructors and messages that implement `scale::Decode`
/// according to the contructors or messages selectors and their arguments.
/// to their exported constructors and messages that implement `scale::Decode`
/// according to the constructors or messages selectors and their arguments.
/// These `enum` dispatch types are then given to this procedure as the `T`.
///
/// When using ink! users do not have to construct those enum dispatch types
......@@ -139,7 +139,7 @@ pub trait EnvBackend {
/// - If the output could not be properly decoded.
/// - If some extension specific condition has not been met.
///
/// # Dev. Note
/// # Developer Note
///
/// A valid implementation applies the `status_to_result` closure on
/// the status code returned by the actual call to the chain extension
......
......@@ -51,8 +51,8 @@ pub trait FromStatusCode: Sized {
/// A concrete instance of a chain extension method.
///
/// This is a utility type used to drive the execution of a chain extension method call.
/// It has several different specializations of its `call` method for different ways to
/// manage error handling when calling a predefined chain extension method.
/// It has several specializations of its `call` method for different ways to manage
/// error handling when calling a predefined chain extension method.
///
/// - `I` represents the input type of the chain extension method.
/// All tuple types that may act as input parameters for the chain extension method are valid.
......@@ -168,12 +168,12 @@ impl<I, O> ChainExtensionMethod<I, O, ()> {
}
}
/// Makes the chain exntesion method call handle the returned status code.
/// Makes the chain extension method call handle the returned status code.
///
/// # Note
///
/// This will handle the returned status code and only loads and decodes the value
/// returned in the output of the chain extension method call in case of success.
/// returned as the output of the chain extension method call in case of success.
#[inline(always)]
pub fn handle_error_code<ErrorCode>(
self,
......@@ -204,7 +204,7 @@ pub mod state {
/// Type state meaning that the chain extension method deliberately does not return a `Result` type.
///
/// Additionally this is enforced by the `#[ink::chain_extension]` proc. macro when used.
/// Additionally this is enforced by the `#[ink::chain_extension]` procedural macro when used.
#[derive(Debug)]
pub struct NoResult<T> {
no_result: PhantomData<fn() -> T>,
......@@ -219,9 +219,9 @@ where
E: scale::Decode + From<ErrorCode> + From<scale::Error>,
ErrorCode: FromStatusCode,
{
/// Calls the chain extension method for case 1A described [here].
/// Calls the chain extension method for case 1.A described [here].
///
/// [here]: [`ChainExtensionMethodInstance`]
/// [here]: [`ChainExtensionMethod`]
///
/// # Errors
///
......@@ -281,9 +281,9 @@ where
T: scale::Decode,
E: scale::Decode + From<scale::Error>,
{
/// Calls the chain extension method for case 2A described [here].
/// Calls the chain extension method for case 2.A described [here].
///
/// [here]: [`ChainExtensionMethodInstance`]
/// [here]: [`ChainExtensionMethod`]
///
/// # Errors
///
......@@ -336,9 +336,9 @@ where
O: scale::Decode,
ErrorCode: FromStatusCode,
{
/// Calls the chain extension method for case 1B described [here].
/// Calls the chain extension method for case 1.B described [here].
///
/// [here]: [`ChainExtensionMethodInstance`]
/// [here]: [`ChainExtensionMethod`]
///
/// # Errors
///
......@@ -395,9 +395,9 @@ where
I: scale::Encode,
O: scale::Decode,
{
/// Calls the chain extension method for case 2B described [here].
/// Calls the chain extension method for case 2.B described [here].
///
/// [here]: [`ChainExtensionMethodInstance`]
/// [here]: [`ChainExtensionMethod`]
///
/// # Panics
///
......
......@@ -14,7 +14,7 @@
//! Implementations of supported cryptographic hash functions.
/// Helper routine implementing variable size BLAKE2b hash computation.
/// Helper routine implementing variable size BLAKE-2b hash computation.
fn blake2b_var(size: usize, input: &[u8], output: &mut [u8]) {
use ::blake2::digest::{
Update as _,
......@@ -25,12 +25,12 @@ fn blake2b_var(size: usize, input: &[u8], output: &mut [u8]) {
blake2.finalize_variable(|result| output.copy_from_slice(result));
}
/// Conduct the BLAKE2 256-bit hash and place the result into `output`.
/// Conduct the BLAKE-2 256-bit hash and place the result into `output`.
pub fn blake2b_256(input: &[u8], output: &mut [u8; 32]) {
blake2b_var(32, input, output)
}
/// Conduct the BLAKE2 128-bit hash and place the result into `output`.
/// Conduct the BLAKE-2 128-bit hash and place the result into `output`.
pub fn blake2b_128(input: &[u8], output: &mut [u8; 16]) {
blake2b_var(16, input, output)
}
......@@ -49,7 +49,7 @@ pub fn keccak_256(input: &[u8], output: &mut [u8; 32]) {
hasher.finalize_into(<&mut GenericArray<u8, _>>::from(&mut output[..]));
}
/// Conduct the SHA2 256-bit hash and place the result into `output`.
/// Conduct the SHA-2 256-bit hash and place the result into `output`.
pub fn sha2_256(input: &[u8], output: &mut [u8; 32]) {
use ::sha2::{
digest::{
......
......@@ -14,7 +14,7 @@
//! External C API to communicate with substrate contracts runtime module.
//!
//! Refer to substrate SRML contract module for more documentation.
//! Refer to substrate FRAME contract module for more documentation.
use crate::ReturnFlags;
use core::marker::PhantomData;
......
......@@ -22,7 +22,7 @@ use crate::engine::off_chain::OffChainError;
pub enum Error {
/// Error upon decoding an encoded value.
Decode(scale::Error),
/// An error that can only occure in the off-chain environment.
/// An error that can only occur in the off-chain environment.
#[cfg(any(feature = "std", test, doc))]
OffChain(OffChainError),
/// The call to another contract has trapped.
......@@ -44,7 +44,7 @@ pub enum Error {
CodeNotFound,
/// The account that was called is either no contract (e.g. user account) or is a tombstone.
NotCallable,
/// An unknown error has occured.
/// An unknown error has occurred.
UnknownError,
}
......
......@@ -14,7 +14,7 @@
//! Provides type definitions and traits for the built-in cryptographic hashes.
/// The output type of a built-in cryptographic hash function.
/// The output type of built-in cryptographic hash functions.
pub trait HashOutput: private::Sealed {
/// The output type of the crypto hash.
///
......@@ -28,7 +28,7 @@ pub trait CryptoHash: HashOutput + private::Sealed {
fn hash(input: &[u8], output: &mut <Self as HashOutput>::Type);
}
/// The SHA2 crypto hash with 256-bit output.
/// The SHA-2 crypto hash with 256-bit output.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Sha2x256 {}
......@@ -36,11 +36,11 @@ pub enum Sha2x256 {}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Keccak256 {}
/// The BLAKE2 crypto hash with 256-bit output.
/// The BLAKE-2 crypto hash with 256-bit output.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Blake2x256 {}
/// The BLAKE2 crypto hash with 128-bit output.
/// The BLAKE-2 crypto hash with 128-bit output.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Blake2x128 {}
......
......@@ -17,7 +17,7 @@
//! Mainly provides entities to work on a contract's storage
//! as well as high-level collections on top of those.
//! Also provides environmental utilities, such as storage allocators,
//! FFI to interface with SRML contracts and a primitive blockchain
//! FFI to interface with FRAME contracts and a primitive blockchain
//! emulator for simple off-chain testing.
#![cfg_attr(not(feature = "std"), no_std)]
......
......@@ -125,7 +125,7 @@ where
{
/// Finalizes the topics builder.
///
/// No more event topics can be serialized afterwards but the environment will be
/// No more event topics can be serialized afterwards, but the environment will be
/// able to extract the information collected by the topics builder in order to
/// emit the serialized event.
pub fn finish(self) -> <B as TopicsBuilderBackend<E>>::Output
......@@ -204,11 +204,11 @@ pub trait Topics {
/// For each topic a hash is generated. This hash must be unique
/// for a field and its value. The `prefix` is concatenated
/// with the `value` and this result is then hashed.
/// with the `value`. This result is then hashed.
/// The `prefix` is typically set to the path a field has in
/// an event struct + the identifier of the event struct.
/// an event struct plus the identifier of the event struct.
///
/// For example, in the case of our Erc20 example contract the
/// For example, in the case of our ERC-20 example contract the
/// prefix `Erc20::Transfer::from` is concatenated with the
/// field value of `from` and then hashed.
/// In this example `Erc20` would be the contract identified,
......
......@@ -27,7 +27,7 @@
//! types is accessible in the contract, not constrained by the required trait
//! bounds.
//!
//! Outside of the contract and its tests (e.g. in the offchain environment), where
//! Outside the contract and its tests (e.g. in the off-chain environment), where
//! there is no knowledge of the concrete types, the functionality is restricted to
//! the trait bounds on the `Environment` trait types.
......@@ -51,7 +51,7 @@ pub trait Environment {
/// The value must match the maximum number of supported event topics of the used runtime.
const MAX_EVENT_TOPICS: usize;
/// The type of an address.
/// The address type.
type AccountId: 'static + scale::Codec + Clone + PartialEq + Eq + Ord;
/// The type of balances.
......@@ -95,7 +95,7 @@ pub trait Environment {
/// The chain extension for the environment.
///
/// This is a type that is defined through the `#[ink::chain_extension]` proc. macro.
/// This is a type that is defined through the `#[ink::chain_extension]` procedural macro.
/// For more information about usage and definition click [this][chain_extension] link.
///
/// [chain_extension]: https://paritytech.github.io/ink/ink_lang/attr.chain_extension.html
......
......@@ -155,7 +155,7 @@ impl CrossCalling<'_> {
}
/// Generates code for the trait implementations required to make the
/// generated ink! storage struct for cross-calling work out of the box
/// generated ink! storage struct for cross-calling work out-of-the-box
/// for the cross-calling infrastructure.
fn generate_standard_impls(&self) -> TokenStream2 {
let cfg = self.generate_cfg();
......
......@@ -394,17 +394,17 @@ pub enum AttributeArg {
/// Applies on ink! chain extension method to set their `func_id` parameter.
/// Every chain extension method must have exactly one ink! `extension` attribute.
///
/// Used by the `#[ink::chain_extension]` proc. macro.
/// Used by the `#[ink::chain_extension]` procedural macro.
Extension(ExtensionId),
/// `#[ink(handle_status = flag: bool)]`
///
/// Used by the `#[ink::chain_extension]` proc. macro.
/// Used by the `#[ink::chain_extension]` procedural macro.
///
/// Default value: `true`
HandleStatus(bool),
/// `#[ink(returns_result = flag: bool)]`
///
/// Used by the `#[ink::chain_extension]` proc. macro.
/// Used by the `#[ink::chain_extension]` procedural macro.
///
/// Default value: `true`
ReturnsResult(bool),
......
......@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/// Computes the BLAKE2b 256-bit hash for the given input and stores it in output.
/// Computes the BLAKE-2b 256-bit hash for the given input and stores it in output.
pub fn blake2b_256(input: &[u8], output: &mut [u8]) {
use ::blake2::digest::{
Update as _,
......
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