Automattic / Automattic/harper
Enhance `PluralWrongWordOfPhrase` with an option to pluralize either both or neither ends
- Dominant language
- Rust
- Stars
- 15.4k
- Forks
- 627
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 106
Description
Currently the `PluralWrongWordOfPhrase` linter corrects set phrases where people pluralize the last word instead of the first: line of codes -> lines of code (also if they pluralize both: rules of thumbs -> rules of thumb)
I just heard somebody in a YouTube video say "suit and ties" and I thought "It's pretty odd to wear two or more ties with a suit" and was in the process of adding this phrase to the linter.
But then I realized:
For this phrase you _do not want_ it to be "suits and tie" - that's also an error that occurs in the wild.
The actual corrections are "suit and tie" and "suits and ties"
I think the way to do it would be to add an enum for which type of fix: `PluralizeFirstSingularizeLast` vs `FirstAndLastMatchingNumber` or something along those lines.
Test snippets for making unit tests from the video and that I found in Stack Exchange sites:
- "... these older 80-year-old liberals in suit and ties who aren't representing the new era ..."
- "I grew up knowing that men wear suit and ties to job interviews and women wear either a suit or a work formal dress"
- "So, if it's suits and tie kind of work, then formal shoe.",
Contributor guide
Research direction
Start at the implementation of the `PluralWrongWordOfPhrase` linter and inspect its existing unit tests. Add coverage for “suit and ties” and “suits and tie”, then verify that the option supports both pluralizing the first and last words and singularizing both where appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100