Skip to content

Fix lowercase acronym pluralization - #86

Open
deepakganesh78 wants to merge 1 commit into
gobuffalo:mainfrom
deepakganesh78:fix/issue71-lowercase-acronym-plural
Open

Fix lowercase acronym pluralization#86
deepakganesh78 wants to merge 1 commit into
gobuffalo:mainfrom
deepakganesh78:fix/issue71-lowercase-acronym-plural

Conversation

@deepakganesh78

Copy link
Copy Markdown

What changed

Fixes #71

Known acronyms are normalized to uppercase in Ident.Parts. The suffix-rule loops therefore matched the uppercase abbreviation rule for inputs such as dns, but ReplaceSuffix could not remove the differently-cased suffix from the original string, producing dnsDNSes.

Suffix rules now run only when the normalized last part is an exact suffix of the original input. Lowercase dns, ids, and https fall through to the existing already-plural handling, while uppercase DNS, IDS, and HTTPS retain their current -es behavior. The same guard is applied to singularization to prevent the analogous duplicated acronym result.

Tests

  • go test ./... -run '^(Test_Pluralize|Test_PluralizeWithSize|Test_Singularize|Test_SingularizeWithSize)$' -count=1
  • go test -cover ./... -count=1
  • go vet ./...
  • golangci-lint run --new-from-rev=main (0 issues)
  • configured legacy linter equivalents (govet, ineffassign, misspell, nakedret, unconvert, staticcheck) (0 issues)

go test -race ./... was attempted, but the local Windows Go toolchain has CGO disabled and no C compiler; the upstream Standard Test workflow will exercise its configured race run.

Only apply case-sensitive suffix rules when the normalized last part is an exact suffix of the original input. This lets lowercase acronyms ending in s fall through to the existing already-plural handling without duplicating their uppercase form.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: flect behaves poorly on the string DNS which pluralizes to dnsDNSes

1 participant