Skip to content

Commit 3d9b938

Browse files
authored
Enable spellcheck in CI/CD (#100)
Enable spellcheck
1 parent 1355d99 commit 3d9b938

File tree

8 files changed

+44
-7
lines changed

8 files changed

+44
-7
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ build = "1.86.0"
2828
format = "nightly-2025-02-16"
2929
lint = "nightly-2025-02-16"
3030
test = "nightly-2025-02-16"
31+
32+
[workspace.metadata.spellcheck]
33+
config = "scripts/spellcheck.toml"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ audit:
2727
--ignore RUSTSEC-2024-0344 $(ARGS)
2828

2929
spellcheck:
30-
@echo "TODO: Implement cargo spellcheck and make fixes"
30+
cargo spellcheck --code 1 $(ARGS)
3131

3232
clippy-%:
3333
cargo $(nightly) clippy --manifest-path $(call make-path,$*)/Cargo.toml \

interface/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ declare_deprecated_id!("StakeConfig11111111111111111111111111111111");
2424
pub struct Config {
2525
/// how much stake we can activate/deactivate per-epoch as a fraction of currently effective stake
2626
pub warmup_cooldown_rate: f64,
27-
/// percentage of stake lost when slash, expressed as a portion of u8::MAX
27+
/// percentage of stake lost when slash, expressed as a portion of `u8::MAX`
2828
pub slash_penalty: u8,
2929
}
3030

interface/src/instruction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub enum StakeInstruction {
5252
/// 0. `[WRITE]` Stake account to be updated
5353
/// 1. `[]` Clock sysvar
5454
/// 2. `[SIGNER]` The stake or withdraw authority
55-
/// 3. Optional: `[SIGNER]` Lockup authority, if updating StakeAuthorize::Withdrawer before
55+
/// 3. Optional: `[SIGNER]` Lockup authority, if updating `StakeAuthorize::Withdrawer` before
5656
/// lockup expiration
5757
Authorize(Pubkey, StakeAuthorize),
5858

@@ -205,7 +205,7 @@ pub enum StakeInstruction {
205205
/// # Account references
206206
/// None
207207
///
208-
/// Returns the minimum delegation as a little-endian encoded u64 value.
208+
/// Returns the minimum delegation as a little-endian encoded `u64` value.
209209
/// Programs can use the [`get_minimum_delegation()`] helper function to invoke and
210210
/// retrieve the return value for this instruction.
211211
///

interface/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ pub enum StakeAuthorize {
282282
)]
283283
#[derive(Default, Debug, PartialEq, Eq, Clone, Copy)]
284284
pub struct Lockup {
285-
/// UnixTimestamp at which this stake will allow withdrawal, unless the
285+
/// `UnixTimestamp` at which this stake will allow withdrawal, unless the
286286
/// transaction is signed by the custodian
287287
pub unix_timestamp: UnixTimestamp,
288288
/// epoch height at which this stake will allow withdrawal, unless the

program/src/helpers/merge.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,11 @@ pub(crate) fn merge_delegation_stake_and_credits_observed(
181181
/// observed of the merged stake is the weighted average of the two stakes'
182182
/// credits observed.
183183
///
184-
/// This is because we can derive the effective credits_observed by reversing
184+
/// This is because we can derive the effective `credits_observed` by reversing
185185
/// the staking rewards equation, _while keeping the rewards unchanged after
186186
/// merge (i.e. strong requirement)_, like below:
187187
///
188+
/// ```text
188189
/// a(N) => account, r => rewards, s => stake, c => credits:
189190
/// assume:
190191
/// a3 = merge(a1, a2)
@@ -197,9 +198,10 @@ pub(crate) fn merge_delegation_stake_and_credits_observed(
197198
/// a3.r = a1.r + a2.r
198199
/// a3.c * a3.s = a1.c * a1.s + a2.c * a2.s
199200
/// a3.c = (a1.c * a1.s + a2.c * a2.s) / (a1.s + a2.s) // QED
201+
/// ```
200202
///
201203
/// (For this discussion, we omitted irrelevant variables, including distance
202-
/// calculation against vote_account and point indirection.)
204+
/// calculation against `vote_account` and point indirection.)
203205
pub(crate) fn stake_weighted_credits_observed(
204206
stake: &Stake,
205207
absorbed_lamports: u64,

scripts/solana.dic

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
1000
2+
activations
3+
autogenerated
4+
codama
5+
config
6+
cooldown
7+
deallocated
8+
entrypoint
9+
fn
10+
lamports
11+
mergeable
12+
pubkey
13+
pubkeys
14+
redelegate
15+
redelegated
16+
redelegation
17+
rpc
18+
staker
19+
struct
20+
sysvar
21+
sysvars
22+
undelegate
23+
undelegated
24+
unstake
25+
unstaked
26+
warmup
27+
withdrawer

scripts/spellcheck.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[Hunspell]
2+
use_builtin = true
3+
skip_os_lookups = false
4+
search_dirs = ["."]
5+
extra_dictionaries = ["solana.dic"]

0 commit comments

Comments
 (0)