fix(config): pluralize names ending in consonant+y as 'ies'#81
Merged
Conversation
EnumLists used a simple suffix rule that handled x/s/z and ch/sh but ignored the y -> ies rule. Type names like Policy or HealthSeverity produced Policys and HealthSeveritys. Apply the standard English rule: consonant + y drops the y and appends ies, vowel + y just appends s. Move the heuristic into a pluralize helper and cover the cases with a unit test.
- Drop redundant c := c loop-variable rebind (Go 1.22+ scoping). - Use testify/require.Equal in the table test. - Generalize pluralize godoc to not tie it to EnumLists. - Trim two redundant test cases.
Emyrk
approved these changes
May 11, 2026
evgeniy-scherbina
added a commit
to coder/coder
that referenced
this pull request
May 11, 2026
Bump coder/guts to v1.7.0. Related PR: coder/guts#81
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.
EnumListsderives a list constant name from each enum type's name using a small suffix heuristic, but it only handledx/s/zandch/sh. Type names ending inywere left to the default rule of "just appends", soPolicybecamePolicys,StorybecameStorys, and so on.The standard English rule for consonant +
yis to drop theyand appendies; vowel +yjust appendss. Apply that rule, move the heuristic into apluralizehelper, and cover the cases with a unit test.This already affects
coder/coder, whereHealthSeveritycurrently generatesHealthSeveritysintypesGenerated.ts.The helper remains best-effort and does not try to recognize already-plural inputs (
AutomaticUpdates->AutomaticUpdateses) or irregular plurals (Person->Persons). Those are out of scope for this fix.Triggered by coder/coder#25122
This PR was opened by a Coder agent on behalf of @evgeniy-scherbina.