Repository navigation
Keep a plural acronym whole before a contraction [patch] - #160
Open
matt-edmondson wants to merge 5 commits into
Open
matt-edmondson wants to merge 5 commits into
matt-edmondson wants to merge 5 commits into
Conversation
With the apostrophe joined out, "CEOs've" reached the word splitter as
"CEOsve". An "s" with more lowercase after it is not a plural, so the
acronym-tail rule broke before the "O": snake "ce_osve", Pascal
"CeOsve", macro "CE_OSVE". The same happened to "VIPs're", "DJs'll",
"MCs'll", with U+2019 too, and to an all-caps contraction ("CEOs'VE").
When an in-word apostrophe follows the "s" of a run of two or more
capitals and the contraction is all lowercase or all caps, the "s" and
the contraction are now uppercased, the way "CEO's" already becomes
"CEOS", so the word stays whole: "ceosve", "Ceosve", "CEOSVE".
Fixes #159
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW3Ri1HBoN2geG4RgBi
SonarCloud flagged ReplaceNonAlphaNumericWithSpace at a cognitive complexity of 18 (S3776, limit 15) once the plural-acronym branch was added. The casing decided at an in-word apostrophe now lives in CaseSuffixAfterApostrophe, which returns the three flags, with no change in behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW3Ri1HBoN2geG4RgBi
This was referenced Nov 5, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5jpiuVuBRXSgitSY1
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
Resolve the conflict in ReplaceNonAlphaNumericWithSpace: keep the PR's CaseSuffixAfterApostrophe helper and carry main's new all-caps-suffix-after- a-single-capital-after-a-digit rule (#174) into it, and keep both IsPluralAcronymEndingAt and main's AppendMarkIfItHasABase. 359/359 tests pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW3gbT4qC2ULvUvM9Dr
|
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 #159
What was wrong
ReplaceNonAlphaNumericWithSpacejoins an in-word apostrophe out beforeSplitOnCaseChangeruns, soCEOs'vereached the splitter asCEOsve. Ansfollowed by more lowercase letters doesn't count as a plural (IsPluralSuffix), so the acronym-tail rule broke before theO:CEOs've/CEOs’vece_osveceosveVIPs're herevi_psre_herevipsre_hereDJs'll playd_jsll_playdjsll_playMCs'llm_csllmcsllCEOs'VEce_osveceosveChange
In
ReplaceNonAlphaNumericWithSpace, a new branch applies when an in-word apostrophe:sof a run of two or more capitals (newIsPluralAcronymEndingAt), andIn that case the
sand the contraction are uppercased, the same wayCEO'salready becomesCEOS, so the splitter sees one all-caps word. A single capital (Ms're) is left alone, because it never split.ToTitleCasetakes a separate path and is unchanged.The all-caps contraction (
CEOs'VE) wasn't in the issue but has the same split, so I covered it in the same branch.Tests
PluralAcronymBeforeAContractionShouldStayOneWordchecks every row of the issue for Title, Pascal, camel, snake, kebab and macro, with both'and U+2019.FormsNextToAPluralAcronymContractionShouldKeepTheirWordspins the neighbouring forms the issue asked to keep:APIs,CEOs,CEO's,CEOs' office,VIPS're,Vips're,O'Reilly,UserIDIsValid,Ms're,CEOS'VE.Verification:
dotnet build -c Releaseof the library across all TFMs succeeds with no warnings.#109, the double-apostrophe case, touches the same apostrophe-joining path. Whichever PR lands second should rebase and rerun both sets of tests.
Generated by Claude Code