Skip to content

fix(core): skip PronounVerbAgreement for hyphenated compound words#3008

Open
mvanhorn wants to merge 1 commit intoAutomattic:masterfrom
mvanhorn:fix/co-founded-false-positive
Open

fix(core): skip PronounVerbAgreement for hyphenated compound words#3008
mvanhorn wants to merge 1 commit intoAutomattic:masterfrom
mvanhorn:fix/co-founded-false-positive

Conversation

@mvanhorn
Copy link
Contributor

Summary

Fixes a false positive where "co-founded" triggers PronounVerbAgreement because "co" is annotated as a pronoun in the dictionary. The linter sees "he" (pronoun) + "co" (verb-like pronoun) and suggests changing "co" to "cos".

Changes

In match_to_lint_with_context, added an early return that checks the after context: if the token immediately following the matched verb is a hyphen, the verb is actually a compound word prefix (like "co-" in "co-founded" or "re-" in "re-established"), not a standalone verb. The lint is skipped in this case.

Added a regression test for "In 2014, he co-founded Social Chain." which previously triggered the false positive.

Files changed: harper-core/src/linting/pronoun_verb_agreement.rs

Testing

All 44 existing tests pass. The 2 pre-existing #[ignore] tests remain unchanged.

test result: ok. 44 passed; 0 failed; 2 ignored; 0 measured; 4963 filtered out

Fixes #3006

This contribution was developed with AI assistance (Claude Code).

When a matched verb is immediately followed by a hyphen, it is part of
a compound word prefix (e.g. "co-founded", "re-established") rather
than a standalone verb. Skip the lint in this case to avoid false
positives like suggesting "cos" for "co" in "he co-founded".

Fixes Automattic#3006

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Collaborator

@hippietrail hippietrail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I think this is the wrong fix because it sweeps a weirder problem under the carpet where it will surely mysteriously emerge from again at random times.

The real fix will probably be something in pronoun code or... it's so weird I'm not sure where else to start looking.

&& next_tok.kind.is_hyphen()
{
return None;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a method for this that seems to have gotten merged recently in expr_linter.rs: followed_by_hyphen() by the way. Probably not very discoverable.

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.

False positive: "co-founded" triggers PronounVerbAgreement

2 participants