Summary
Both typos-format's pyproject.toml/Cargo.toml opt-in check and ruff-format's pyproject.toml opt-in check use a line-anchored grep for a [tool.X] section header:
grep -qE '^[[:space:]]*\[tool\.typos(\]|[.])' "$dir/pyproject.toml"
grep -qE '^[[:space:]]*\[tool\.ruff(\]|[.])' "$dir/pyproject.toml"
TOML allows the equivalent configuration as an inline table under a [tool] header instead:
[tool]
typos = { default = { extend-words = { ... } } }
Both tools (verified empirically for typos-cli 1.44.0) honor this form when actually run. Neither hook's grep recognizes it, so a repo using this style is treated as "no config" and the hook silently skips — a false-negative on the opt-in gate, not an incorrect correction.
Impact
Low. Inline-table syntax for an entire [tool.X] section is unusual in practice — TOML style strongly favors the [tool.X] header form for anything beyond a single scalar value. Surfaced by Codex review on #872 (typos-format), applies identically to the already-shipped ruff-format.
Why not fixed inline
A robust fix needs real TOML parsing (inline tables can span multiple lines, nest arbitrarily, and the typos/ruff key can appear in any order within [tool]). A multi-pass grep heuristic ("has [tool]" + "has a typos = or ruff = line somewhere after it") risks false positives from an unrelated typos = \"...\"/ruff = \"...\" key in a different table, or from commented-out lines. Out of scope for a fast, dependency-free, cross-platform bash hook.
Related
Summary
Both
typos-format's pyproject.toml/Cargo.toml opt-in check andruff-format's pyproject.toml opt-in check use a line-anchored grep for a[tool.X]section header:TOML allows the equivalent configuration as an inline table under a
[tool]header instead:Both tools (verified empirically for typos-cli 1.44.0) honor this form when actually run. Neither hook's grep recognizes it, so a repo using this style is treated as "no config" and the hook silently skips — a false-negative on the opt-in gate, not an incorrect correction.
Impact
Low. Inline-table syntax for an entire
[tool.X]section is unusual in practice — TOML style strongly favors the[tool.X]header form for anything beyond a single scalar value. Surfaced by Codex review on #872 (typos-format), applies identically to the already-shippedruff-format.Why not fixed inline
A robust fix needs real TOML parsing (inline tables can span multiple lines, nest arbitrarily, and the
typos/ruffkey can appear in any order within[tool]). A multi-pass grep heuristic ("has[tool]" + "has atypos =orruff =line somewhere after it") risks false positives from an unrelatedtypos = \"...\"/ruff = \"...\"key in a different table, or from commented-out lines. Out of scope for a fast, dependency-free, cross-platform bash hook.Related
docs/topics/lint-static-analysis-gaps/PLAN.md).