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
60
80
WebAssembly
Wasm
Wasm32
validator
ERC
fuzzer
......@@ -29,13 +30,26 @@ getter
bitvector
dereferencing
recurse
kb
kB
scalability
scalable
adjunctive
invariants
deserializes
DApp
RPC
AST
untyped
variadic
evaluable
multisig
Gnosis
stdin
stdout
interoperate
cryptographic
Polkadot
bitwise
hasher/S
hashmap/S
......@@ -50,3 +64,8 @@ layout/JG
endian/P
accessor/S
NFT/S
encoding/S
blockchain/S
backend/S
namespace/S
runtime/S
......@@ -152,9 +152,6 @@ docs:
spellcheck:
stage: workspace
<<: *docker-env
rules:
- if: $CI_PIPELINE_SOURCE == "pipeline"
when: never
script:
- cargo spellcheck check --cfg=.config/cargo_spellcheck.toml --checkers hunspell --code 1
- for example in examples/*/; do
......
......@@ -50,7 +50,7 @@ Following these will ensure that your pull request is going to be accepted.
Please try to fix them by yourself and resolve all remaining to-do items.
If that is not possible then write an issue for each of them and link to the source line and commit with a proper description. For more information go [here](#Issues-&-pull-requests).
1. Document everything properly that you have written, refactored or touched. Especially keeping documentation up-to-date is very important. For larger portions please try to also update the ink! wiki or write a new entry there.
1. Write tests for your code. If your code is hard to test, try to find a design that allows for testability.
1. Write tests for your code. If your code is hard to test, try to find a design that allows for testing.
1. If needed also update the [`README`](README.md).
1. For performance critical parts we also want additional performance tests.
1. If you implement a fix for a reported bug also include a regression test alongside the fix if possible.
......
......@@ -243,7 +243,7 @@ pub struct Spreaded {
### Packing Storage
We can alter this behaviour by using the `ink_storage::Pack` abstraction:
We can alter this behavior by using the `ink_storage::Pack` abstraction:
```rust
pub struct Spreaded {
......@@ -972,7 +972,7 @@ caller of a function or amount of value sent), but these will be added back in t
## ink!-less Implementations
It is also possible to annotate an entire impl blocks with:
It is also possible to annotate an entire `impl` blocks with:
```rust
#[ink(impl)]
......@@ -983,6 +983,6 @@ impl Contract {
}.
```
This is useful if the `impl` block itself doesn't contain any ink! constructors or messages, but you
This is useful if the `impl` block itself does not contain any ink! constructors or messages, but you
still need to access some of the "magic" provided by ink!. In the example above, you would not have
access to `emit_event` without `#[ink(impl)]`.
......@@ -421,7 +421,7 @@ impl Engine {
/// Copies the `slice` into `output`.
///
/// Panics if the slice is too large and doesn't fit.
/// Panics if the slice is too large and does not fit.
fn set_output(output: &mut &mut [u8], slice: &[u8]) {
if slice.len() > output.len() {
panic!(
......
......@@ -177,11 +177,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.
///
/// # Errors
///
......@@ -415,7 +415,7 @@ where
/// 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.
/// - Restoration is cancelled if there is no tombstone in the destination
/// - Restoration is canceled if there is no tombstone in the destination
/// address or if the hashes don't match. No changes are made in this case.
pub fn restore_contract<T>(
account_id: T::AccountId,
......@@ -467,7 +467,7 @@ where
///
/// # Errors
///
/// - If the contract doesn't have sufficient funds.
/// - If the contract does not have sufficient funds.
/// - 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<()>
......
......@@ -49,7 +49,7 @@ use ink_primitives::Key;
/// The capacity of the static buffer.
/// This is the same size as the ink! on-chain environment. We chose to use the same size
/// to be as close to the on-chain behavior as possible.
const BUFFER_SIZE: usize = 1 << 14; // 16kB
const BUFFER_SIZE: usize = 1 << 14; // 16 kB
impl CryptoHash for Blake2x128 {
fn hash(input: &[u8], output: &mut <Self as HashOutput>::Type) {
......
......@@ -140,7 +140,7 @@ pub fn recorded_debug_messages() -> RecordedDebugMessages {
///
/// # Note
///
/// Useful for benchmarking because it ensures the initialized storage is maintained across runs,
/// Useful for benchmarks because it ensures the initialized storage is maintained across runs,
/// because lazy storage structures automatically clear their associated cells when they are dropped.
pub fn set_clear_storage_disabled(_disable: bool) {
unimplemented!(
......@@ -233,7 +233,7 @@ where
})
}
/// Runs the given closure test function with the default configuartion
/// Runs the given closure test function with the default configuration
/// for the off-chain environment.
pub fn run_test<T, F>(f: F) -> Result<()>
where
......
......@@ -89,12 +89,12 @@ impl Block {
/// # Note
///
/// - This is the off-chain environment implementation of
/// [`random`][`crate::random`]. It provides the same behaviour in that it
/// [`random`][`crate::random`]. It provides the same behavior in that it
/// will likely yield the same hash for the same subjects within the same
/// block (or execution context).
///
/// - Returned hashes on the surface might appear random, however for
/// testability purposes the actual implementation is quite simple and
/// testing purposes the actual implementation is quite simple and
/// computes those "random" hashes by wrapping XOR of the internal entry hash
/// with the eventually repeated sequence of the subject buffer.
pub fn random<T>(&self, subject: &[u8]) -> Result<T::Hash>
......
......@@ -198,7 +198,7 @@ impl EnvInstance {
);
// Initialize the execution context for the first contract execution.
use crate::call::Selector;
// The below selector bytes are incorrect but since calling doesn't work
// The below selector bytes are incorrect but since calling does not work
// yet we do not have to fix this now.
let selector_bytes_for_call = [0x00; 4];
self.exec_context.push(
......
......@@ -206,7 +206,7 @@ where
.map_err(Into::into)
}
/// Update the [ChainSpec](`crate::test::ChainSpec`) for the test environment
/// Update the [`ChainSpec`](`crate::test::ChainSpec`) for the test environment
pub fn update_chain_spec<F>(f: F) -> Result<()>
where
F: FnOnce(&mut ChainSpec),
......@@ -261,7 +261,7 @@ where
///
/// # Note
///
/// Useful for benchmarking because it ensures the initialized storage is maintained across runs,
/// Useful for benchmarks because it ensures the initialized storage is maintained across runs,
/// because lazy storage structures automatically clear their associated cells when they are dropped.
pub fn set_clear_storage_disabled(disable: bool) {
<EnvInstance as OnInstance>::on_instance(|instance| {
......@@ -321,7 +321,7 @@ where
})
}
/// Runs the given closure test function with the default configuartion
/// Runs the given closure test function with the default configuration
/// for the off-chain environment.
pub fn run_test<T, F>(f: F) -> Result<()>
where
......
......@@ -41,14 +41,14 @@ pub struct TypedEncoded<T> {
/// - If this is `None` it means that the instance is currently untyped
/// and will take over any given type upon the first typed interaction.
/// - This is needed since instances of `TypedEncoded` are going to be used
/// in static memory where it isn't possible to decide about the used types
/// in static memory where it is not possible to decide about the used types
/// given by `Environment` at initialization.
type_id: Option<TypeId>,
/// Classification marker.
///
/// # Note
///
/// - This shouldn't be the typed that is actually stored as encoded
/// - This should not be the typed that is actually stored as encoded
/// representation in `self.encoded` but should primarily be an
/// abstract marker type that may be used for classification.
/// - The idea behind the marker is to say that whenever two instances
......@@ -245,7 +245,7 @@ impl<M> TypedEncoded<M> {
Ok(())
}
/// Evaluates the given clousure on the given typed encoded instances.
/// Evaluates the given closure on the given typed encoded instances.
pub fn eval<T, F, R>(&self, other: &Self, f: F) -> Result<R>
where
T: scale::Decode + 'static,
......@@ -257,7 +257,7 @@ impl<M> TypedEncoded<M> {
Ok(f(&decoded_self, &decoded_other))
}
/// Evaluates the given clousure on the given typed decoded instances
/// Evaluates the given closure on the given typed decoded instances
/// and writes back the result into the typed encoded instance.
pub fn eval_mut<T, F, R>(&mut self, other: &Self, f: F) -> Result<R>
where
......
......@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/// A static buffer with 16kB of capacity.
/// A static buffer with 16 kB of capacity.
pub struct StaticBuffer {
/// The static buffer with a total capacity of 16kB.
/// The static buffer with a total capacity of 16 kB.
buffer: [u8; Self::CAPACITY],
}
impl StaticBuffer {
/// The capacity of the static buffer.
const CAPACITY: usize = 1 << 14; // 16kB
const CAPACITY: usize = 1 << 14; // 16 kB
/// Creates a new static buffer.
pub const fn new() -> Self {
......@@ -105,7 +105,7 @@ impl<'a> scale::Output for EncodeScope<'a> {
///
/// # Note
///
/// This is used to efficiently chunk up ink!'s internal static 16kB buffer
/// This is used to efficiently chunk up ink!'s internal static 16 kB buffer
/// into smaller sub buffers for processing different parts of computations.
#[derive(Debug)]
pub struct ScopedBuffer<'a> {
......@@ -122,7 +122,7 @@ impl<'a> From<&'a mut [u8]> for ScopedBuffer<'a> {
impl<'a> ScopedBuffer<'a> {
/// Splits the scoped buffer into yet another piece to operate on it temporarily.
///
/// The splitted buffer will have an offset of 0 but be offset by `self`'s offset.
/// The split buffer will have an offset of 0 but be offset by `self`'s offset.
pub fn split(&mut self) -> ScopedBuffer {
ScopedBuffer {
offset: 0,
......
......@@ -652,9 +652,9 @@ pub fn random(subject: &[u8], output: &mut &mut [u8]) {
#[cfg(feature = "ink-debug")]
/// Call `seal_debug_message` with the supplied UTF-8 encoded message.
///
/// If debug message recording is disabled in the contracts pallet, the first call to will
/// return LoggingDisabled error, and further calls will be a no-op to avoid the cost of calling
/// into the supervisor.
/// If debug message recording is disabled in the contracts pallet, the first call will
/// return a `LoggingDisabled` error, and further calls will be a no-op to avoid the cost
/// of calling into the supervisor.
///
/// # Note
///
......
......@@ -170,7 +170,7 @@ where
}
impl EnvInstance {
/// Returns a new scoped buffer for the entire scope of the static 16kB buffer.
/// Returns a new scoped buffer for the entire scope of the static 16 kB buffer.
fn scoped_buffer(&mut self) -> ScopedBuffer {
ScopedBuffer::from(&mut self.buffer[..])
}
......
......@@ -27,11 +27,11 @@ use super::OnInstance;
/// The on-chain environment.
pub struct EnvInstance {
/// Encode & decode buffer with static size of 16kB.
/// Encode & decode buffer with static size of 16 kB.
///
/// If operations require more than that they will fail.
/// This limit was chosen after benchmarking Substrate storage
/// storage and load performance and was found to be a sweet spot.
/// This limit was found to be a sweet spot after running benchmarks
/// on Substrate's storage and load performance.
///
/// Please note that this is still an implementation detail and
/// might change. Users should generally avoid storing too big values
......
......@@ -294,7 +294,7 @@ pub struct RentParams<T: Environment> {
/// The fraction of the deposit costs that should be used as rent per block.
///
/// When a contract doesn't have enough balance deposited to stay alive indefinitely
/// When a contract does not have enough balance deposited to stay alive indefinitely
/// it needs to pay per block for the storage it consumes that is not covered by the
/// deposit. This determines how high this rent payment is per block as a fraction
/// of the deposit costs.
......@@ -322,18 +322,18 @@ pub struct RentParams<T: Environment> {
///
/// # Note
///
/// The `current_*` fields do **not** consider changes to the code's refcount made during
/// the currently running call.
/// The `current_*` fields do **not** consider changes to the code's `refcount`
/// made during the currently running call.
#[derive(scale::Decode)]
#[cfg_attr(test, derive(Debug, PartialEq))]
pub struct RentStatus<T: Environment> {
/// Required deposit assuming that this contract is the only user of its code.
pub max_deposit: T::Balance,
/// Required deposit assuming the code's current refcount.
/// Required deposit assuming the code's current `refcount`.
pub current_deposit: T::Balance,
/// Required deposit assuming the specified refcount (`None` if `0` is supplied).
/// Required deposit assuming the specified `refcount` (`None` if `0` is supplied).
pub custom_refcount_deposit: Option<T::Balance>,
/// Rent that is paid assuming that the contract is the only user of its code.
......
......@@ -194,7 +194,7 @@ impl Dispatch<'_> {
}
}
/// Generates code for the dispatch trait impls for a generic ink! callable.
/// Generates code for the dispatch trait implementations for a generic ink! callable.
fn generate_trait_impls_for_callable<C>(
&self,
cws: ir::CallableWithSelector<'_, C>,
......@@ -247,7 +247,7 @@ impl Dispatch<'_> {
/// Returns a tuple of:
///
/// - Vector over the generated identifier bindings (`__ink_binding_N`) for all inputs.
/// - `TokenStream` representing the binding identifiers as tuple (for >=2 inputs),
/// - `TokenStream` representing the binding identifiers as tuple (for equal to two or more inputs),
/// as single identifier (for exactly one input) or as wildcard (`_`) if there are
/// no input bindings.
///
......@@ -271,7 +271,7 @@ impl Dispatch<'_> {
/// # ;
/// ```
///
/// **Multiple (>=2) inputs:**
/// **Multiple (equal to two or more) inputs:**
/// ```
/// # use quote::quote;
/// # let __ink_binding_0 = ();
......
......@@ -374,7 +374,7 @@ mod tests {
/// line
),
syn::parse_quote!(
/// commments
/// comments
),
])
.collect::<Vec<_>>(),
......@@ -382,7 +382,7 @@ mod tests {
" multiple".to_string(),
" single".to_string(),
" line".to_string(),
" commments".to_string(),
" comments".to_string(),
],
);
assert_eq!(
......
......@@ -25,7 +25,7 @@ use quote::{
};
use syn::spanned::Spanned as _;
/// 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 Storage<'a> {
contract: &'a ir::Contract,
......
Markdown is supported
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