feat: add --ignore-sic to skip misspellings marked with [sic]#3950
Open
kojiromike wants to merge 1 commit into
Open
feat: add --ignore-sic to skip misspellings marked with [sic]#3950kojiromike wants to merge 1 commit into
kojiromike wants to merge 1 commit into
Conversation
The opt-in --ignore-sic flag skips a misspelling immediately followed by the editorial "[sic]" marker. Only the single occurrence preceding the marker is ignored, so other misspellings on the same line are still reported. A closing quote may sit between the word and the marker, which is the common case when documenting a corrected typo in a changelog, e.g. `correct the "wrod" [sic] typo`. Unlike codespell:ignore, the marker is part of the prose itself and does not require naming the word in a tooling comment. Closes codespell-project#3764 Assisted-by: Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3764.
Summary
Adds an opt-in
--ignore-sicflag that skips a misspelling immediately followed by the editorial[sic]marker.correct the "wrod" [sic] typo.[sic]/[SIC]), with optional whitespace before the marker.Motivation
The existing inline mechanisms are all annotations aimed at the tool:
codespell:ignore(whole line),codespell:ignore <word>(by spelling, not position — it can't target a single occurrence and requires naming the typo in a comment), andcodespell:ignore-next-line. None of these fit prose where an intentional/quoted misspelling appears, such as a changelog entry announcing a typo fix.[sic]is a long-standing editorial convention that already belongs in the text on its own merits, so reusing it costs the document nothing and needs no tooling comment. Because it changes default behavior only when explicitly requested, it is gated behind a flag rather than folded intocodespell:ignore.Implementation
sic_regexand an--ignore-sicargument (default off).re.match(line, match.end())anchor.Test plan
test_ignore_sic: bare/quoted/whitespace/case variants, the changelog quoted form, single-occurrence scoping, and negative cases ((sic),[sick], intervening word). Asserts off-by-default behavior too.ruff check,ruff format --check,mypy --strictclean.wrod, so no new ignore-words entry).test_basic.pysuite: 82 passed, 1 skipped.