Skip to content

Commit 6db12be

Browse files
committed
chore: replace cspell with typos-cli, bump MSRV to 1.94.0
Spell checking: - Replace cspell (Node.js) with typos-cli (Rust) for spell checking - Add typos.toml with domain-specific allowlist (author names, math terms) - Delete cspell.json (107 lines of word dictionary no longer needed) - Update justfile spell-check recipe to use typos on modified files - Add _ensure-typos helper and typos-cli to setup-tools install/verify - Update CI to install typos-cli via taiki-e/install-action instead of npm cspell Toolchain: - Bump rust-version to 1.94 (Cargo.toml) and channel to 1.94.0 (rust-toolchain.toml)
1 parent e33db49 commit 6db12be

8 files changed

Lines changed: 92 additions & 130 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: CI
2-
# cspell:ignore rhysd binstall mktemp sha256sum sha256sums shasum
32
permissions:
43
contents: read
54
concurrency:
@@ -24,8 +23,8 @@ env:
2423
RUST_BACKTRACE: 1
2524
ACTIONLINT_VERSION: "1.7.10"
2625
MARKDOWNLINT_VERSION: "0.47.0"
27-
CSPELL_VERSION: "9.6.2"
2826
SHFMT_VERSION: "3.12.0"
27+
TYPOS_VERSION: "1.43.4"
2928
UV_VERSION: "0.9.28"
3029

3130
jobs:
@@ -68,7 +67,7 @@ jobs:
6867
with:
6968
version: ${{ env.UV_VERSION }}
7069

71-
- name: Install Node.js (for markdownlint and cspell)
70+
- name: Install Node.js (for markdownlint)
7271
if: matrix.os != 'windows-latest'
7372
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
7473
with:
@@ -77,7 +76,13 @@ jobs:
7776
- name: Install Node.js packages
7877
if: matrix.os != 'windows-latest'
7978
run: |
80-
npm install -g markdownlint-cli@${{ env.MARKDOWNLINT_VERSION }} cspell@${{ env.CSPELL_VERSION }}
79+
npm install -g markdownlint-cli@${{ env.MARKDOWNLINT_VERSION }}
80+
81+
- name: Install typos-cli
82+
if: matrix.os != 'windows-latest'
83+
uses: taiki-e/install-action@f92912fad184299a31e22ad070a5059fd07d4f59 # v2.68.7
84+
with:
85+
tool: typos-cli@${{ env.TYPOS_VERSION }}
8186

8287
- name: Install taplo (for TOML formatting and linting)
8388
if: matrix.os != 'windows-latest'

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ When making changes in this repo, prioritize (in order):
2929
- Python tests: `just test-python`
3030
- Run a single test (by name filter): `cargo test solve_2x2_basic` (or the full path: `cargo test lu::tests::solve_2x2_basic`)
3131
- Run examples: `just examples` (or `cargo run --example det_5x5` / `cargo run --example solve_5x5`)
32-
- Spell check: `just spell-check` (uses `cspell.json` at repo root; keep the `words` list sorted lexicographically)
32+
- Spell check: `just spell-check` (uses `typos.toml` at repo root; add false positives to `[default.extend-words]`)
3333

3434
## Code structure (big picture)
3535

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "la-stack"
33
version = "0.1.3"
44
edition = "2024"
5-
rust-version = "1.93"
5+
rust-version = "1.94"
66
license = "BSD-3-Clause"
77
description = "Small, stack-allocated linear algebra for fixed dimensions"
88
readme = "README.md"

cspell.json

Lines changed: 0 additions & 107 deletions
This file was deleted.

justfile

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ _ensure-taplo:
4949
set -euo pipefail
5050
command -v taplo >/dev/null || { echo "❌ 'taplo' not found. See 'just setup' or install: brew install taplo (or: cargo install taplo-cli)"; exit 1; }
5151

52+
# Internal helper: ensure typos-cli is installed
53+
_ensure-typos:
54+
#!/usr/bin/env bash
55+
set -euo pipefail
56+
command -v typos >/dev/null || { echo "❌ 'typos' not found. See 'just setup-tools' or install: cargo install typos-cli"; exit 1; }
57+
5258
_ensure-uv:
5359
#!/usr/bin/env bash
5460
set -euo pipefail
@@ -379,6 +385,13 @@ setup-tools:
379385
echo " ✓ samply"
380386
fi
381387

388+
if ! have typos; then
389+
echo " ⏳ Installing typos-cli (cargo)..."
390+
cargo install --locked typos-cli
391+
else
392+
echo " ✓ typos"
393+
fi
394+
382395
if ! have cargo-tarpaulin; then
383396
if [[ "$os" == "Linux" ]]; then
384397
echo " ⏳ Installing cargo-tarpaulin (cargo)..."
@@ -393,7 +406,7 @@ setup-tools:
393406
echo ""
394407
echo "Verifying required commands are available..."
395408
missing=0
396-
for cmd in uv jq taplo yamllint shfmt shellcheck actionlint node npx; do
409+
for cmd in uv jq taplo yamllint shfmt shellcheck actionlint node npx typos; do
397410
if have "$cmd"; then
398411
echo " ✓ $cmd"
399412
else
@@ -442,22 +455,42 @@ shell-fmt: _ensure-shfmt
442455

443456
shell-lint: shell-check
444457

445-
# Spell check (cspell)
446-
#
447-
# Requires either:
448-
# - `cspell` on PATH (recommended: `npm i -g cspell`), or
449-
# - `npx` (will run cspell without a global install)
450-
spell-check:
458+
# Spell check (typos)
459+
spell-check: _ensure-typos
451460
#!/usr/bin/env bash
452461
set -euo pipefail
453-
if command -v cspell >/dev/null; then
454-
cspell lint --config cspell.json --no-progress --gitignore --cache --dot --exclude cspell.json .
455-
elif command -v npx >/dev/null; then
456-
npx cspell lint --config cspell.json --no-progress --gitignore --cache --dot --exclude cspell.json .
462+
files=()
463+
# Use -z for NUL-delimited output to handle filenames with spaces.
464+
#
465+
# Note: For renames/copies, `git status --porcelain -z` emits *two* NUL-separated paths.
466+
# The ordering can differ depending on the porcelain output, so we read both and
467+
# spell-check whichever one exists on disk.
468+
while IFS= read -r -d '' status_line; do
469+
status="${status_line:0:2}"
470+
filename="${status_line:3}"
471+
472+
# For renames/copies, consume the second path token to keep parsing in sync.
473+
# Prefer the path that exists on disk to avoid passing stale paths to typos.
474+
if [[ "$status" == *"R"* || "$status" == *"C"* ]]; then
475+
if IFS= read -r -d '' other_path; then
476+
if [ ! -e "$filename" ] && [ -e "$other_path" ]; then
477+
filename="$other_path"
478+
fi
479+
fi
480+
fi
481+
482+
# Skip deletions (file may no longer exist).
483+
if [[ "$status" == *"D"* ]]; then
484+
continue
485+
fi
486+
487+
files+=("$filename")
488+
done < <(git status --porcelain -z --ignored=no)
489+
if [ "${#files[@]}" -gt 0 ]; then
490+
# Exclude typos.toml itself: it intentionally contains allowlisted fragments.
491+
printf '%s\0' "${files[@]}" | xargs -0 -n100 typos --config typos.toml --force-exclude --exclude typos.toml --
457492
else
458-
echo "❌ cspell not found. Install via npm (recommended): npm i -g cspell"
459-
echo " Or ensure npx is available (Node.js)."
460-
exit 1
493+
echo "No modified files to spell-check."
461494
fi
462495

463496
# Testing

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[toolchain]
22
# Pin to MSRV as specified in Cargo.toml
3-
channel = "1.93.0"
3+
channel = "1.94.0"
44

55
# Essential components for development
66
components = [

src/vector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<const D: usize> Vector<D> {
7979
/// ```
8080
#[inline]
8181
#[must_use]
82-
pub fn dot(self, other: Self) -> f64 {
82+
pub const fn dot(self, other: Self) -> f64 {
8383
let mut acc = 0.0;
8484
let mut i = 0;
8585
while i < D {
@@ -100,7 +100,7 @@ impl<const D: usize> Vector<D> {
100100
/// ```
101101
#[inline]
102102
#[must_use]
103-
pub fn norm2_sq(self) -> f64 {
103+
pub const fn norm2_sq(self) -> f64 {
104104
self.dot(self)
105105
}
106106
}

typos.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Configuration for typos-cli (https://github.com/crate-ci/typos)
2+
3+
[files]
4+
# Avoid scanning generated/third-party directories and auto-generated files.
5+
extend-exclude = [
6+
".git/**",
7+
"target/**",
8+
"coverage/**",
9+
"node_modules/**",
10+
"venv/**",
11+
".venv/**",
12+
".mypy_cache/**",
13+
".ruff_cache/**",
14+
".pytest_cache/**",
15+
]
16+
17+
[default.extend-words]
18+
# Domain terms that typos suggests "fixing" but are correct in this repo.
19+
# Author / person names
20+
Brezinski = "Brezinski"
21+
Businger = "Businger"
22+
Getchell = "Getchell"
23+
Higham = "Higham"
24+
Parlett = "Parlett"
25+
Schreiber = "Schreiber"
26+
Tikhomirov = "Tikhomirov"
27+
Trefethen = "Trefethen"
28+
# Math / crate terms
29+
faer = "faer"
30+
frhs = "frhs"
31+
nrhs = "nrhs"

0 commit comments

Comments
 (0)