Repository navigation
Keep uppercasing a contraction's suffixes past its second apostrophe [patch] - #163
Merged
Merged
Conversation
…[patch]
"I'd've".ToSnakeCase() gave "i_dve" and "Y'all'd" gave "yal_ld", where the
lowercase spellings give "idve" and "yalld".
ReplaceNonAlphaNumericWithSpace uppercases a lowercase suffix after a capital
("CEO's" -> "CEOS") so the word reads as one all-caps run. The decision was
made afresh at each apostrophe from the letter before it, so at the second
apostrophe of "I'd've" the lowercase "d" switched it off, giving "IDve", which
SplitOnCaseChange split as an acronym plus a word. Once a word's suffix is
being uppercased, its later lowercase suffixes now are too, until the word
ends.
Fixes #109
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW4bh3rDc6opLckXQGb
The #109 condition took ReplaceNonAlphaNumericWithSpace's cognitive complexity from 15 to 16, over Sonar's S3776 limit. The decision now lives in its own method, with the comment that explained it. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4bh3rDc6opLckXQGb
This was referenced Nov 5, 2026
…contractions-109 # Conflicts: # CaseConverter.Test/CaseConverterTests.cs # CaseConverter/CaseConverter.cs
|
matt-edmondson
pushed a commit
that referenced
this pull request
Nov 11, 2026
#163 already moved the apostrophe-suffix condition into UppercasesSuffix, which resolves the same S3776 complexity finding, so take main's line and drop the now-unused IsSuffixUppercasedOntoCapital helper. 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
Resolve the conflict with #163 in ReplaceNonAlphaNumericWithSpace: CaseSuffixAfterApostrophe keeps the plural-acronym branch and now takes its uppercase decision from main's UppercasesSuffix, so a later lowercase suffix of an uppercased word stays uppercased (#109). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4bDHFRUmCXATBKDFr
This was referenced Nov 11, 2026
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 #109
What was wrong
"I'd've".ToSnakeCase()gavei_dveand"Y'all'd"gaveyal_ld. Their lowercase spellings giveidveandyalld.ReplaceNonAlphaNumericWithSpaceuppercases a lowercase suffix that follows a capital (CEO's→CEOS), so the word reads as one all-caps run. That decision was made again at each apostrophe, from the letter just before it. At the second apostrophe ofI'd've, the lowercasedturned it off. The result wasIDve, whichSplitOnCaseChangethen split into an acronym and a word.Change
Once a word's suffix is being uppercased, its later lowercase suffixes are uppercased too, until the word ends. The flag is still reset at a real separator, as before. This is the first bullet of the issue's suggested fix.
The other two bullets from the issue were not needed. The
rock'N'rollanda'B'crows already gaveRocknroll/Abcon current main, because thelowercaseSuffix/lowercaseNextLetterwork landed after the issue was filed.a'B'cstill disagreed between Title→snake and snake, though, and this change fixes that.I'd'vei_dveidveIDveIdveY'all'dyal_ldyalldYalLdYalldTests
AContractionWithSeveralApostrophesShouldConvertLikeItsLowercaseForm. It covers every row in the issue table, plus U+2019,Y'all'd'veandCEO's's. Each input must convert like its all-lowercase form in Pascal, camel, snake, kebab and MACRO, and Title→snake must match snake.AContractionWithSeveralApostrophesShouldStayOneWord. It checks the expected outputs from the issue directly.dotnet build CaseConverter.slnbuilds every target with no warnings.Not covered: a mixed-case later suffix such as
I'd'VEstill givesi_dve, which is outside this issue's table.Merge note: #162 (fixes #161) edits the same
uppercaseSuffixstatement. Whichever PR lands second needs a one-line rebase that keeps both conditions.Generated by Claude Code