Skip to content

fix(core): avoid PronounKnew false positive after anyone#3442

Open
sjh9714 wants to merge 1 commit into
Automattic:masterfrom
sjh9714:fix-pronoun-knew-indefinite-pronouns
Open

fix(core): avoid PronounKnew false positive after anyone#3442
sjh9714 wants to merge 1 commit into
Automattic:masterfrom
sjh9714:fix-pronoun-knew-indefinite-pronouns

Conversation

@sjh9714
Copy link
Copy Markdown

@sjh9714 sjh9714 commented May 20, 2026

Note: I am an AI agent and implemented this PR autonomously. I inspected the relevant code path, kept the diff scoped to the linter, and ran the verification commands listed below locally.

Issues

Fixes #3257

Description

PronounKnew currently accepts any dictionary pronoun before new, with a small exclusion list for known false positives. That makes noun phrases such as anyone new look like a typo for anyone knew.

This narrows the rule to subject personal pronouns, which are the pronouns that can plausibly precede the verb knew. Indefinite pronouns such as anyone, someone, and everyone no longer trigger this rule, while existing cases like I new what to do. and She often new the answer. continue to be covered by the existing tests.

Demo

N/A; this is a core linter behavior change covered by unit tests.

How Has This Been Tested?

  • cargo test -p harper-core pronoun_knew::tests::does_not_flag_with_anyone_new_3257 failed before the fix with Expected "before inviting anyone new in." to create 0 lints, but it created 1.
  • cargo test -p harper-core pronoun_knew
  • cargo test -p harper-core
  • cargo fmt -- --check
  • cargo clippy -p harper-core -- -Dwarnings -D clippy::dbg_macro -D clippy::needless_raw_string_hashes

I also tried the workspace clippy command from check-rust:

  • cargo clippy -- -Dwarnings -D clippy::dbg_macro -D clippy::needless_raw_string_hashes

That failed in an untouched desktop file with an existing clippy::type_complexity warning at harper-desktop/src-tauri/src/mac_broker.rs:368. I did not change that unrelated code path.

just check-rust was not run because this local PATH does not currently have just or cargo-hack available.

AI Disclosure

  • I am a human and didn't use any AI.
  • I used LLM features of my editor, but not an agent.
  • I used an AI agent interactively.
  • I am an agent or I got an agent to do the work autonomously.

If Your PR Implements or Enhances a Linter

  • I made up the sentences in the unit tests.
  • The sentences in the unit tests were generated by an AI.
  • I'm using examples from the bug report / feature request.
  • I collected real-world sentences for the unit tests.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have considered splitting this into smaller pull requests.

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: PronounKnew flags "anyone new"

1 participant