Repository navigation
fix(harper-core): keep possessive its unflagged after prepositions - #4437
Merged
elijah-potter merged 3 commits intoSep 30, 2026
Merged
elijah-potter merged 3 commits into
elijah-potter merged 3 commits into
Conversation
`ItsContraction` flagged phrases like "in its reading" when the gerund was tagged as a verb and the following word was neither a noun nor an auxiliary. A possessive `its` introduced by a preposition is part of a noun phrase, so skip the lint in that context while keeping strong predicative verbs such as "its been" and "its got" flagged. Fixes Automattic#4435
elijah-potter
requested changes
Sep 29, 2026
Comment on lines
+261
to
+281
| fn is_preposition(word: &str) -> bool { | ||
| matches!( | ||
| word, | ||
| "at" | "by" | ||
| | "for" | ||
| | "from" | ||
| | "in" | ||
| | "into" | ||
| | "of" | ||
| | "on" | ||
| | "onto" | ||
| | "over" | ||
| | "through" | ||
| | "to" | ||
| | "under" | ||
| | "upon" | ||
| | "with" | ||
| | "within" | ||
| | "without" | ||
| ) | ||
| } |
Member
There was a problem hiding this comment.
You should be able to perform this check with functions that already exist in core. Try maybe using is_upos or check the word metadata.
jvoisin
pushed a commit
to jvoisin/harper
that referenced
this pull request
Oct 17, 2026
…utomattic#4437) * fix(harper-core): keep possessive "its" unflagged after prepositions `ItsContraction` flagged phrases like "in its reading" when the gerund was tagged as a verb and the following word was neither a noun nor an auxiliary. A possessive `its` introduced by a preposition is part of a noun phrase, so skip the lint in that context while keeping strong predicative verbs such as "its been" and "its got" flagged. Fixes Automattic#4435 * fix(core): use token metadata for its preposition check --------- Co-authored-by: Elijah Potter <me@elijahpotter.dev>
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.
AI disclosure: tests were drafted with AI assistance; implementation and checks were done and verified by me.
Fixes
Fixes #4435
ItsContractionflaggeditsbefore a gerund (e.g.in its reading) because the gerund is tagged as a verb and the following word is neither a noun nor an auxiliary.This is a false positive: after a preposition,
itsis possessivein it's readingis not valid English.Changes
harper-core/src/linting/its_contraction/general.rs: skip the lint when the possessive is introduced by a preposition, via newis_prepositionhelper. True positives likeits been,its got,its hadremain flagged.harper-core/src/linting/its_contraction/mod.rs: added 2 regression tests.Testing
cargo test -p harper-core→ 6564 passed, 0 failedcargo test -p harper-core its_contraction→ 58 passedcargo fmt --checkcleanin its readingcase no longer produces a lint, whileIts been months since we spoke.still does.