Consolidate codespell config into pyproject.toml for standalone use

Refactor codespell setup so `codespell` (or `uvx codespell`) works
standalone without relying on pre-commit args or separate ignore files.

Config changes:
- Expanded skip patterns: *.bib (author names), *.png (embedded text),
  *.scss, _extensions (third-party Quarto code), socratiQ (bundled JS),
  build outputs (_site, _book, htmlcov), caches (.cache, .npm)
- Added ignore-regex for camelCase/PascalCase identifiers and URLs
- Added documented ignore-words-list for legitimate terms (contributor
  names, abbreviations, TikZ labels, domain terms)
- Removed .codespell-ignore-words.txt (had merge conflict markers;
  contents merged into pyproject.toml)

Relaxed exclusions (no longer blanket-skipped):
- *.json (only .all-contributorsrc skipped now)
- *.js (only socratiQ skipped now)
- *.tex (only _extensions skipped now)

Pre-commit: removed custom args/exclude overrides, bumped to v2.4.1,
now uses pyproject.toml config via tomli dependency.

Typo fix: akumulators → accumulators (inject_quizzes.lua comment)

Co-Authored-By: Claude Code 2.1.63 / Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Yaroslav Halchenko
2026-03-07 12:20:54 -05:00
parent 966990b973
commit 408c0a13ce
4 changed files with 19 additions and 46 deletions

View File

@@ -1,39 +0,0 @@
heros
fith
curren
aline
gage
akumulators
ans
titel
socio
ser
currenty
initialy
assertin
mor
dota
appen
multline
ource
bu
sting
te
crossreference
linez
als
fo
listin
nam
ture
handlin
panting
occurence
socio-economic
rin
nd
ure
<<<<<<< Updated upstream
=======
ure
>>>>>>> Stashed changes

View File

@@ -37,12 +37,13 @@ repos:
exclude: "^(_site/)"
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
# Configuration for codespell is in pyproject.toml
rev: v2.4.1
hooks:
- id: codespell
name: "Global: Check for common misspellings"
args: ["--skip", "*.json,*.bib,*.js,*.tex,_site,_book,node_modules,.venv,htmlcov", "--ignore-words", ".codespell-ignore-words.txt"]
exclude: "^(_site/|_book/|htmlcov/|.*\\.js$)"
additional_dependencies:
- tomli
# ===========================================================================
# SECTION 2: BOOK HOOKS (quarto content validation)

View File

@@ -332,7 +332,7 @@ local function insert_quizzes(doc)
return b.t == "Header" and b.level == 1
end
-- akumulators
-- accumulators
local new_blocks = {}
local chapter_blocks = {}
local chapter_answers = {}

View File

@@ -268,7 +268,18 @@ skips = ["B101", "B601"] # Skip assert_used and shell=True (sometimes needed)
[tool.codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = '.git,.gitignore,.gitattributes,*.pdf,*.svg,*.ai,package-lock.json,*.css,*.min.*'
skip = '.git,.gitignore,.gitattributes,*.pdf,*.svg,*.ai,*.png,*.bib,*.css,*.scss,*.min.*,package-lock.json,_site,_book,node_modules,.venv,.tox,htmlcov,.cache,.npm,.all-contributorsrc,*/socratiQ/*,*/_extensions/*,.codespell-ignore-words.txt,.codespell-ignore'
check-hidden = true
# ignore-regex = ''
# ignore-words-list = ''
# Ignore camelCase and PascalCase identifiers (common in TikZ/code), and URLs
ignore-regex = '\b[a-z]+[A-Z]\w*\b|\b[A-Z][a-z]+[A-Z]\w*\b|https?://\S+'
# rin/curren - contributor names; nd - abbreviation (2nd, CC BY-ND);
# ans - variable for "answer"; mor - person name (Mor Harchol-Balter);
# dota - the game; ser - abbreviation (Speech Emotion Recognition);
# fo - TikZ node label; als - Alternating Least Squares algorithm;
# appen - company name; handlin - person name; ource/ure - regex fragments;
# multline - LaTeX amsmath environment; panting/sting - correct English words;
# unknow - intentional usage; gage - person name (Philip Gage);
# aline/linez - TikZ style names; socio - prefix (socio-economic);
# heros - TeX Gyre Heros font; fith - PDF FitH parameter;
# activ - abbreviation for Activation; te - regex fragment
ignore-words-list = 'rin,curren,nd,ans,mor,dota,ser,fo,als,appen,handlin,ource,ure,multline,panting,sting,unknow,gage,aline,linez,socio,heros,fith,activ,te,ture'