Skip to content

Commit 8bc30ba

Browse files
committed
Setup spellcheck with typos
Has few false positives
1 parent 5a919bb commit 8bc30ba

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

Justfile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ test-single:
77
# Test on current python version
88
uv run pytest
99

10-
check: mypy _check && check-format
10+
check: mypy _check && check-format spellcheck
1111

1212
# runs additional checks
1313
_check:
1414
-ruff check src
1515

16-
fix: && format
16+
fix: && _format fix-spelling
1717
@# Failure to fix should not prevent formatting
1818
-ruff check --fix src
1919

@@ -40,8 +40,18 @@ _test_ver pyver:
4040
@# Using --isolated avoids clobbering dev environment
4141
@uv run --isolated --python {{pyver}} --only-group test pytest --quiet
4242

43+
# Check for spelling issues
44+
spellcheck:
45+
# Check for obvious spelling issues
46+
typos
47+
48+
# Fix obvious spelling issues
49+
fix-spelling:
50+
# Fix obvious spelling issues
51+
typos --write-changes
52+
4353
# Checks for formatting issues
44-
check-format:
54+
check-format: && spellcheck
4555
@# Invoking ruff directly instead of through uv tool run saves ~12ms per command,
4656
@# reducing format --check src time from ~20ms to ~8ms.
4757
@# it reduces time for `ruff --version` from ~16ms to ~3ms.
@@ -50,6 +60,8 @@ check-format:
5060
ruff format --check .
5161
ruff check --select I --output-format concise .
5262

53-
format:
63+
format: _format && spellcheck
64+
65+
_format:
5466
ruff format .
5567
ruff check --select 'I' --fix .

_typos.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[default.extend-words]
2+
# Pydantic uses 'ser' as a shorthand for 'serialize'
3+
# See issue crate-ci/typos#1318
4+
ser = "ser"

lefthook.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ pre-commit:
1616
tags: formatter
1717
glob: "*.{py,pyi}"
1818
run: ruff check --select 'I' --output-format 'concise' -- {staged_files}
19+
typos:
20+
tags: spellcheck
21+
run: typos --force-exclude -- {staged_files}

0 commit comments

Comments
 (0)