Repository navigation
Keep a contraction's plural after a capital run in one word [patch] - #169
Merged
matt-edmondson merged 1 commit intoNov 11, 2026
Merged
Conversation
"DON'Ts" snaked to "do_nts" and "the DOs and DON'Ts" to
"the_dos_and_do_nts", while Title case gives "Don'ts". The suffix "Ts"
is not all lowercase, so it was not uppercased onto the capital before
the apostrophe; the O'Neil rule then lowered the "T", leaving "DONts",
which SplitOnCaseChange reads as the acronym "DO" plus "Nts".
When the capital before the apostrophe ends a run of two or more
capitals and the suffix is one capital followed only by lowercase
letters, the suffix is now uppercased too, giving "DONTS" as "DONTs" and
"DON'TS" already do. A single capital before the apostrophe ("O'Neil")
keeps the O'Neil rule.
Fixes #165
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW2QxLJ6PwV5nQrv4Us
|
matt-edmondson
deleted the
fix/capital-run-before-apostrophe-plural-165
branch
November 11, 2026 00:02
matt-edmondson
pushed a commit
that referenced
this pull request
Nov 11, 2026
Resolve the test-file conflict with #169: both added a test method at the end of the class, so keep both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW2QxLJ6PwV5nQrv4Us
matt-edmondson
pushed a commit
that referenced
this pull request
Nov 11, 2026
#169 widened the condition that uppercases a suffix onto the capital before an in-word apostrophe, which took ReplaceNonAlphaNumericWithSpace to a cognitive complexity of 17 (Sonar S3776, limit 15) and fails the quality gate. The condition now lives in IsSuffixUppercasedOntoCapital; behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW2QxLJ6PwV5nQrv4Us
matt-edmondson
added a commit
that referenced
this pull request
Nov 11, 2026
* Keep a titlecase digraph after an apostrophe in its word [patch] "a'Džemal" snaked to "a_džemal" while the two-letter spelling "a'Džemal" gives "adžemal". IsCapitalAfterApostropheInLowercaseContext tested char.IsUpper on the letter after the apostrophe, which is false for a titlecase digraph (category Lt), so the O'Neil rule never lowered it. SplitOnCaseChange then saw a lowercase-to-titlecase change and broke the word. The test now uses IsUpperOrTitlecase, as SplitOnCaseChange has since #158, so "a'Džemal" and "l'Ljubljana" give the same words as their two-letter spellings in every converter. Fixes #167 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW2QxLJ6PwV5nQrv4Us * Move the apostrophe-suffix uppercase test into its own helper [patch] #169 widened the condition that uppercases a suffix onto the capital before an in-word apostrophe, which took ReplaceNonAlphaNumericWithSpace to a cognitive complexity of 17 (Sonar S3776, limit 15) and fails the quality gate. The condition now lives in IsSuffixUppercasedOntoCapital; behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW2QxLJ6PwV5nQrv4Us --------- Co-authored-by: Claude <noreply@anthropic.com>
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.



Fixes #165
What was wrong
"DON'Ts"snaked todo_nts, and"the DOs and DON'Ts"snaked tothe_dos_and_do_nts. Title case givesDon'ts, so converting through Title case changed the words.The steps that produced it:
Tsis not all lowercase, so it was not uppercased onto the capital before the apostrophe.T, leavingDONts.SplitOnCaseChangeread that as the acronymDOfollowed byNts.Change
This takes the fix the issue proposed, written as two small helpers,
EndsCapitalRunandIsCapitalThenLowercase. Both step back and forward by code point and over combining marks, as the neighbouring helpers do.The new rule: when the capital before the apostrophe ends a run of two or more capitals, and the suffix is one capital followed only by lowercase letters, the suffix is uppercased too. That gives
DONTS, which is whatDONTsandDON'TSalready give.When only one capital comes before the apostrophe, as in
O'Neil, the O'Neil rule still applies.DON'Ts/DON’TsdontsDontsDon'tsCAN'TscantsCantsABC'DsabcdsAbcdsthe DOs and DON'Tsthe_dos_and_dontsTheDosAndDontsO'Neil,DON'T stop,CEO'sTests
AContractionPluralAfterACapitalRunShouldStayOneWord. It covers the five acceptance-criteria inputs, including U+2019.Title→snake == snake.O'Neil,o'NEIL,CEO'sandDON'Trows still pass.dotnet build CaseConverter.slngives 0 warnings and 0 errors.The open PRs #160, #162, #163 and #168 also touch the apostrophe branch of
ReplaceNonAlphaNumericWithSpace. As the triage noted, whichever lands last should rebase and rerun the full suite.Generated by Claude Code