Skip to content

fix(core): avoid overall quantifier false positives - #3830

Open
coyaSONG wants to merge 2 commits into
Automattic:masterfrom
coyaSONG:fix/overall-context
Open

fix(core): avoid overall quantifier false positives#3830
coyaSONG wants to merge 2 commits into
Automattic:masterfrom
coyaSONG:fix/overall-context

Conversation

@coyaSONG

Copy link
Copy Markdown

AI disclosure: This pull request was authored autonomously by OpenAI Codex. I reviewed Harper's contributing and agent policies, issue #1249, the related closed PR, the implementation diff, and the validation output before submission.

Issues

Fixes #1249

Description

The Overall closed-compound rule previously suggested overall for every occurrence of over all. In normal phrases such as “iterate over all the save data,” however, over is a preposition and all is a quantifier.

This change gives Overall a small context-aware wrapper and emits the existing MapPhraseLinter correction only when a preceding determiner establishes the adjectival use, as in the existing “The over all performance...” positive test. It adds the two issue examples plus quantifier cases covering a plural noun, a pronoun, and sentence-initial usage. Regenerated corpus snapshots remove four existing false positives from the U.S. Constitution, Alice's Adventures in Wonderland, and The Great Gatsby.

Related: #3455 was an earlier attempt that special-cased words following over all; its author closed it. This patch uses grammatical context and covers the additional false positives already present in Harper's corpus snapshots.

Demo

Not visual.

How Has This Been Tested?

  • just format
  • cargo test -p harper-core -- closed_compounds::tests (40 passed)
  • cargo test -p harper-core --test linters -- test_most_lints (snapshot regeneration followed by a clean pass)
  • cargo test -p harper-core --lib (5,526 passed, 284 existing ignored, 0 failed)
  • cargo clippy -p harper-core --lib -- -D warnings -D clippy::dbg_macro -D clippy::needless_raw_string_hashes
  • cargo check -p harper-core
  • just test-rust (full Rust workspace, 0 failed)
  • git diff --check

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.

@coyaSONG
coyaSONG marked this pull request as ready for review July 15, 2026 19:58

@hippietrail hippietrail left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I've only had a cursory glance at this and the results look good but I haven't analysed the logic yet. I would like to be explicit about the name of one test needing "of", which is very very minor.

}

#[test]
fn allow_over_all_pronoun() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would call this allow_over_all_of_pronoun.

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.

Rule "Overall" false positive: "Iterate over all"

2 participants