feat(core): flag "tenant" misused for "tenet" - #3822
Conversation
"tenant" (a renter) is often written where "tenet" (a principle) is
meant. Adds the TenantTenet rule, which flags "tenant"/"tenants" after a
principle-sense adjective (core, central, fundamental, guiding, ...) and
suggests "tenet"/"tenets" ("a core tenant of good design" -> "a core
tenet of good design").
Real-estate senses ("the main tenant", "three tenants") are left alone.
Closes Automattic#1070
46acc68 to
13ed6d4
Compare
hippietrail
left a comment
There was a problem hiding this comment.
(I wrote this message hours ago while on the road, but it seems as though I failed to submit it?)
I would like to see this run over a large corpus of real-world text somehow. Mainly because when I was researching this with tons of manual Google searches I found "tenant" used legitimately in tech contexts far more than I was expecting. So much so that it proved very difficult to find examples of the mistake.
By the way, I've never heard or read anybody using "tenet" when they intend the meaning of "tenant" so we don't need to handle that case.
Now I've tried quite a lot to get an AI agent to harvest real-world examples for Harper testing and so far I've not found anything that works. In particular I can't get them to automate my way, which is Google searches with search operators to include all inflections and sometimes wildcards. But I've only used free AI tools. Maybe somebody with access to paid tools who is interested in tackling this can do it.
"tenant" is used legitimately as a noun modifier in multi-tenancy
writing ("core tenant isolation", "fundamental tenant model"), where the
adjective binds to the whole compound rather than to "tenant" itself.
Require the following token to be a non-noun so those cases are left
alone, and cover them with tests.
The trade-off is that a sentence-final "a core tenant." is no longer
flagged, since there is no following token to inspect. Avoiding the
false positives is worth more than catching that form.
|
Good call — you were right, and it did fire on the tech usage you mentioned. Going looking for it, I hit exactly that:
The problem is that in multi-tenancy writing Pushed a fix: the rule now requires the token after
One trade-off worth flagging: a sentence-final Agreed on the direction, too — the rule only goes On the corpus point: I don't have a good automated harvesting setup either. What I have done instead is keep the trigger deliberately narrow — only the nine principle-sense adjectives, plus the noun-modifier exclusion — so it stays conservative and misses real instances ( |
Issues
Closes #1070.
Description
tenant(a renter) is commonly written wheretenet(a principle) is meant — "a core tenant of good design", "the main tenants of many religions". Harper did not catch this.This adds a
TenantTenetrule that flagstenant/tenantswhen it follows a principle-sense adjective (core,central,fundamental,basic,guiding,cardinal,underlying,foundational,defining) and suggeststenet/tenets:a core tenant of good design→a core tenet of good designthe central tenants of the movement→the central tenets of the movementTo keep false positives low, it deliberately only fires after that adjective set, where the renter reading is implausible. Real-estate senses are left untouched —
the main tenant,a key tenant,three tenants,commercial tenants. Broader frames (e.g. baretenants of X) are intentionally out of scope for now, sincetenantis a valid word and over-flagging would be worse than the occasional miss.The rule is a grouped Weir rule (singular + plural children under
TenantTenet/) because the two forms need different replacements.No related PRs.
Demo
How Has This Been Tested?
Embedded Weir tests (16 correction cases + 8 negative cases across the two children):
Rust suite (rule registration + curated-config drift check):
Also checked by hand that renter-sense phrases (
the main tenant,a key tenant,three tenants) stay clean.AI Disclosure
If Your PR Implements or Enhances a Linter
Checklist