Skip to content

fix: don't read the pronoun one as a count before a participle (#3819) - #3889

Open
lukiod wants to merge 2 commits into
Automattic:masterfrom
lukiod:fix/participle-with-object-not-mass-noun
Open

fix: don't read the pronoun one as a count before a participle (#3819)#3889
lukiod wants to merge 2 commits into
Automattic:masterfrom
lukiod:fix/participle-with-object-not-mass-noun

Conversation

@lukiod

@lukiod lukiod commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Issues

Fixes #3819

Description

NounCountability matches a count quantifier followed by a mass-noun-only word. In the reported sentence:

That way, we can keep the rankings and the questions separated without worrying about the scaling of one affecting the other.

affecting carries mass noun metadata and one is in the quantifier set, so the rule fired and suggested one piece of affecting.

But one here is a pronoun, the object of of, with affecting the other a participial phrase modifying it. There is no count quantifier before a mass noun, which is the only shape this rule targets. That is what the issue title says as well.

The guard therefore skips when the matched quantifier is one, it is preceded by of, and the mass noun is an -ing form.

This is narrower than my first attempt, and the reason is worth recording. @hippietrail pointed out in review that a gerund can head a noun phrase and still take an object, so an -ing word having an object tells you nothing about whether it is nominal. That is correct, and testing turned up two concrete cases where wider rules silence real errors:

Wider rule Sentence it wrongly silences
"a determiner after an -ing form makes it verbal" Every training the company offers is mandatory. — the determiner opens a relative clause modifying training, not an object of it
"one after of is a pronoun" The cost of one advice.of one also occurs with a genuine quantifier

Both are real errors that master catches. Requiring both conditions keeps the change to the construction actually reported.

For a linter, trading a false positive for missed errors is the worse deal, so I checked for that specifically rather than only checking that the reported sentence stopped firing.

Demo

Not applicable, this is a harper-core rule change with no UI surface.

How Has This Been Tested?

cargo test -p harper-core — 5684 passed, 0 failed. cargo fmt --check clean, cargo clippy introduces no new warnings.

The two false-negative cases were confirmed by disabling only the new guard and re-running: with it disabled both are caught, with the first version of the guard enabled both were missed. That is how they were found rather than assumed.

New tests:

  • the sentence from the issue
  • Some people do not like eating peas. — the gerund-with-object example from review
  • Every training the company offers is mandatory. and Every funding the government provides is audited. — relative clause, must still flag
  • They questioned the cost of one advice.of one with a real quantifier, must still flag

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.

The issue sentence and the eating peas example come from the bug report and from review respectively. The relative clause and of one sentences are constructed, because they exist to pin specific failure modes; I have not verified them against a corpus, and I would treat that as a real limitation of this PR given the point raised in review about invented test cases.

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.

…attic#3819)

"affecting" is the participle of "affect" and carries mass noun metadata,
so a quantifier before it matched NounCountability. In "the scaling of one
affecting the other" that produced the suggestion "one piece of affecting".

There is already a guard for verbal -ing forms, but it looks for a modifier
chain ending in a head noun, as in "much programming knowledge", and it
treats a determiner as the end of that chain. "affecting the other" is the
other verbal shape: the determiner opens the participle's own object rather
than closing a noun phrase, so the existing guard stopped at "the" and the
lint was emitted.

A determiner directly after an -ing form is a sufficient signal on its own,
because a mass noun does not take an object. "much writing the letter" is
not a noun phrase however it is read.

Keyed on the -ing form so plain mass nouns are unaffected: "one advice the
other day" is still flagged, which a test covers alongside the reported
sentence and a second participle.

5681 tests pass.
@hippietrail

Copy link
Copy Markdown
Collaborator

Please use the provided PR template.
I'm assuming this is done by an AI agent. The PR template provides for disclosing the essentials of this.

All -ing forms of verbs can act as both present participles and gerunds. Gerunds behave as mass nouns by default (though may also have countable senses) and can still take objects:

Some people do not like eating peas.

Here "eating" is both a noun, the object of the verb "to like" and a verb, with its own object, "peas".

This kind of thing makes it very tricky to parse the context around a potential mistake to determine if it's really a mistake or actually a legitimate usage. We have to be aware of when it's not a simple "either/or" such as "it can't be a noun because it's a verb" and have to see if there's a way to determine whether it's acting as a noun or a verb etc. in this particular context. Which can require analysing the next word along, which may also have some kind of ambiguity.

Coding AIs tend to ignore this unless you spell it out for them and even then you might have to find concrete examples to convince them, and even then they make mistakes about how whitespace and punctuation are tokenized.

We don't ban AI and humans make many of these same kinds of assumptions, but we should know what we're up against when we ask an AI to write a grammar checker rule.

Review raised that a gerund can head a noun phrase and still take an object,
so an -ing word with an object says nothing about whether it is nominal. That
is correct, and testing turned up two concrete cases the previous approach got
wrong.

Keying on a determiner after an -ing form silences real errors, because the
determiner may open a relative clause modifying the -ing word rather than an
object of it. "Every training the company offers is mandatory" is a genuine
error and the earlier guard hid it. Verified by disabling only that guard, at
which point the case is caught again.

Keying on "of" before "one" is also wrong, because "of one" occurs with a real
quantifier too, as in "the cost of one advice".

Requiring both, the pronoun "one" after "of" and a following participle, keeps
the change to the construction the issue actually reports. This matches the
report's own title, which identifies "one" as a pronoun rather than anything
about -ing words.

Tests cover the reported sentence, the gerund-with-object example from review,
both relative clause cases, and "of one" before a plain mass noun.
@lukiod lukiod changed the title fix: do not treat an -ing word taking an object as a mass noun (#3819) fix: don't read the pronoun one as a count before a participle (#3819) Jul 27, 2026
@lukiod

lukiod commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, both points taken, and the second one turned out to be right in a way I could reproduce.

I've filled in the PR template, including the AI disclosure. Apologies for missing it.

On the grammar: you're correct that all -ing forms can be gerunds, that gerunds behave as mass nouns by default, and that they can still take objects. Some people do not like eating peas is exactly the case my reasoning glossed over, and I've added it as a test.

Rather than argue the point I went looking for a sentence where my rule actually breaks, and there is one:

Every training the company offers is mandatory.

Here the opens a relative clause modifying training, not an object of it. That's a genuine error the rule should flag, and my first patch silenced it. Confirmed by disabling only that guard and re-running: with the guard removed it's caught, with it in place it's missed. So the patch traded one false positive for a class of false negatives, which for a linter is the worse trade.

Going back to your issue title, the real problem is narrower than what I fixed. In the scaling of one affecting the other, one is a pronoun, the object of of. Nothing about -ing words needed to be involved.

I also checked the obvious narrower rule, "one after of is a pronoun", and that's wrong too, because of one occurs with a genuine quantifier, as in The cost of one advice. So the guard now requires both the of and the participle.

On invented test sentences, that's a fair caution and I'd flag it against my own PR: the issue sentence and eating peas come from the report and from you, but the two relative-clause sentences and the of one one are constructed. They pin specific failure modes rather than demonstrate real-world usage, and I haven't checked them against a corpus. If you'd rather see corpus examples for those before this goes in, that seems reasonable to me.

cargo test -p harper-core is green at 5684 passed.

@lukiod

lukiod commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Please use the provided PR template. I'm assuming this is done by an AI agent. The PR template provides for disclosing the essentials of this.

All -ing forms of verbs can act as both present participles and gerunds. Gerunds behave as mass nouns by default (though may also have countable senses) and can still take objects:

Some people do not like eating peas.

Here "eating" is both a noun, the object of the verb "to like" and a verb, with its own object, "peas".

This kind of thing makes it very tricky to parse the context around a potential mistake to determine if it's really a mistake or actually a legitimate usage. We have to be aware of when it's not a simple "either/or" such as "it can't be a noun because it's a verb" and have to see if there's a way to determine whether it's acting as a noun or a verb etc. in this particular context. Which can require analysing the next word along, which may also have some kind of ambiguity.

Coding AIs tend to ignore this unless you spell it out for them and even then you might have to find concrete examples to convince them, and even then they make mistakes about how whitespace and punctuation are tokenized.

We don't ban AI and humans make many of these same kinds of assumptions, but we should know what we're up against when we ask an AI to write a grammar checker rule.

yah sry about that my ai went a way to abroad but yan need things for a big project so i thought of keeping things automated so as i can focus on the main issue but yah from now on will take care of things before creating a pr mb man

@lukiod

lukiod commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@hippietrail brother can i expect a review or anything on this

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: "one" as a pronoun before mass noun

2 participants