Skip to content

feat: handle some false positives in let/lets/let's/let us #1085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

hippietrail
Copy link
Collaborator

@hippietrail hippietrail commented Apr 18, 2025

But doing so has a snowball effect on other tests!

Issues

May try to tackle: #470 #752

Description

Tackles false positives and other problems related to mixing up
let / lets / let's / let us

One problem was flagging let/lets to be replaced by let's if the next word is a verb, but there were many false positives caused by words which are both nouns and verbs.

Unfortunately simply ruling those out had flow-on effects in other lints or other tests.

I've commented out some of those tests and added comments about the problem.

Some may be able to be re-enabled if heuristics are devised to disambiguate whether such words are really verbs or nouns.

I've also added comments to explain how some of the existing logic works and renamed some identifiers I felt impeded clarity.

How Has This Been Tested?

I've added a bunch of unit tests for various types of false positives.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes

@hippietrail hippietrail marked this pull request as ready for review April 18, 2025 21:41
@elijah-potter elijah-potter added this pull request to the merge queue Apr 21, 2025
Merged via the queue into Automattic:master with commit 6ef5e59 Apr 21, 2025
22 checks passed
@hippietrail hippietrail deleted the let_lets_let_us_improvements branch April 21, 2025 16:44
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request May 10, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [Automattic/harper/harper-ls](https://github.com/Automattic/harper) | minor | `v0.29.1` -> `v0.34.1` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>Automattic/harper (Automattic/harper/harper-ls)</summary>

### [`v0.34.1`](https://github.com/Automattic/harper/releases/tag/v0.34.1)

[Compare Source](Automattic/harper@v0.34.0...v0.34.1)

#### What's Changed

-   feat:definitive article→definite article by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1248
-   fix(obsidian): odd padding around message by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1252
-   feat: Correct "infront" and other phrases written as a single word by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1192

**Full Changelog**: Automattic/harper@v0.34.0...v0.34.1

### [`v0.34.0`](https://github.com/Automattic/harper/releases/tag/v0.34.0)

[Compare Source](Automattic/harper@v0.33.0...v0.34.0)

#### What's Changed

-   feat: articles implies no verb by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1188
-   build(deps): bump hashbrown from 0.15.2 to 0.15.3 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1230
-   fix(obsidian): pretty-print the lint kind by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1235
-   test: add snapshots for linters by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1228
-   feat: disambiguate prepositions followed by determiners by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1187
-   Nominal phrase test helper by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1227
-   feat: add single token pattern trait by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1209
-   feat:one in the same→one and the same by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1154
-   fix(core): long sentence lint should start with word by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1236
-   refactor: remove unnecessary Option in PhrasalVerbAsCompoundNoun by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1243
-   refactor: don't allocate when linting chunks by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1242
-   feat(core): use Rayon in snapshot tests by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1237
-   Tweaks for Chrome Extension by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1244
-   feat(web): render HTML descriptions on rules page by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1240
-   fix(core): don't misplace `ParagraphBreak` tokens by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1239
-   fix: fix indefinite article for "utter(ly)" by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1247
-   feat: Improved metadata applied by affix system by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1214

**Full Changelog**: Automattic/harper@v0.33.0...v0.34.0

### [`v0.33.0`](https://github.com/Automattic/harper/releases/tag/v0.33.0)

[Compare Source](Automattic/harper@v0.32.1...v0.33.0)

#### What's Changed

-   Create a Chrome extension by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1072
-   Documentation updates by [@&#8203;mcecode](https://github.com/mcecode) in Automattic/harper#1233
-   ci: add `cargo hack` by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1160
-   fix(chrome-ext): render on scroll by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1234
-   refactor: use `LSend` trait to simplify trait definitions by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1225
-   build(deps): bump chrono from 0.4.40 to 0.4.41 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1231
-   fix: "towards" is a preposition by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1213
-   perf(core): `PlainEnglish` parser in `ExactPhrase` by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1217
-   test(ls): ensure we write sorted dictionaries by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1205
-   fix: prevent crash in PhrasalVerbAsCompoundNoun by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1210
-   fix: Remove verb property from "of" by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1206
-   feat(cli): fallback to `PlainEnglish` parser by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1223
-   fix: heuristic for no-contraction-with-verb for "let go" by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1203
-   chore: minor typos in two files' comments by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1218

**Full Changelog**: Automattic/harper@v0.32.1...v0.33.0

### [`v0.32.1`](https://github.com/Automattic/harper/releases/tag/v0.32.1)

[Compare Source](Automattic/harper@v0.31.0...v0.32.1)

#### What's Changed

-   feat: aswell→as well by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1161
-   Fix false positive in let/lets→let's by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1158
-   feat: last ditched/ditch→last-ditch by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1147
-   build: add caching by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1172
-   feat: implement `assert_any_suggestion_result` as in [#&#8203;950](Automattic/harper#950) by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1033
-   Add `core_version` to `harper-core` by [@&#8203;HobbitJack](https://github.com/HobbitJack) in Automattic/harper#1168
-   fix(core): runaway `harper-ls` processes by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1163
-   fix(core): ignore whitespace when matching case by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1165
-   Rules by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1128
-   fix(core): don't lex the last period as part of a number by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1162
-   fix([#&#8203;1051](Automattic/harper#1051)): Ignore potential ordinal suffixes of length greater than 2 by [@&#8203;grantlemons](https://github.com/grantlemons) in Automattic/harper#1054
-   docs: fix incorrect documentation for some linters by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1151
-   refactor: Rename `ACO` to `Word` by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1149
-   fix(core): allow erroneous `shift` usage in spellcheck by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1166
-   feat: iterator API for pattern matches by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1155
-   feat: Flag phrasal verbs spelled as compound nouns by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#991
-   fix(core): improve `Dashes` description by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1174
-   Add snapshot tests for token metadata (aka part-of-speech tags) by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1119
-   docs(readme): fix grammar and minor rephrasing by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1176
-   feat: zero-width patterns by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1153
-   chore(harper-core/dictionary): add unpublish(ing) forms with flags by [@&#8203;uncenter](https://github.com/uncenter) in Automattic/harper#1180
-   feat(core): avoid providing multiple lints for a single long hyphen sequence in `Dashes` by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1182
-   feat: once a while→once in a while by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1191
-   chore(harper-core/dictionary): add developer-related nouns by [@&#8203;uncenter](https://github.com/uncenter) in Automattic/harper#1179
-   fix: running individual tests was broken by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1184
-   feat: how it looks like→how it looks/what it looks like by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1146
-   chore(harper-core/dictionary): add Tree-sitter by [@&#8203;uncenter](https://github.com/uncenter) in Automattic/harper#1193
-   fix: add exception to possessive_your linter by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1201
-   feat(ls): write sorted dictionaries by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1195
-   feat: dictionary curation and dialect tests by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1197
-   chore(harper-core/dictionary): add manufacturable and favicon by [@&#8203;uncenter](https://github.com/uncenter) in Automattic/harper#1194
-   fix: exception for "how did you" in how-to linter by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1200
-   feat:Guilded Age→Gilded Age; once and a while→once in a while by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1196
-   fix: heuristics to fix "comparison to expected results" by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1186
-   chore: convert commented out tests to use `#[ignore]` by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1199
-   Print version numbers by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1204

#### New Contributors

-   [@&#8203;HobbitJack](https://github.com/HobbitJack) made their first contribution in Automattic/harper#1168
-   [@&#8203;uncenter](https://github.com/uncenter) made their first contribution in Automattic/harper#1180

**Full Changelog**: Automattic/harper@v0.31.0...v0.32.1

### [`v0.31.0`](https://github.com/Automattic/harper/releases/tag/v0.31.0)

[Compare Source](Automattic/harper@v0.30.0...v0.31.0)

#### What's Changed

-   No invalid `private = true` fields in `Cargo.toml` by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1120
-   Dictionary curation 2025 04 22 by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1122
-   Flags the definite article used together with a possessive by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1112
-   dictionary: Added Schengen by [@&#8203;jpds](https://github.com/jpds) in Automattic/harper#1083
-   Removed the useless `SequencePattern` in `IndefiniteArticle` by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1125
-   Use `Option<NonZeroUsize>` as the return type of `Pattern::matches` by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1124
-   fix: Make code compile without `concurrent` feature by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1140
-   refactor: removed unused patterns by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1141
-   Dictionary curation 2025 04 25 by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1136
-   feat: `Document` QoL functions for tokens & words by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1117
-   feat: invest into→invest in by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1139

#### New Contributors

-   [@&#8203;jpds](https://github.com/jpds) made their first contribution in Automattic/harper#1083

**Full Changelog**: Automattic/harper@v0.30.0...v0.31.0

### [`v0.30.0`](https://github.com/Automattic/harper/releases/tag/v0.30.0)

[Compare Source](Automattic/harper@v0.29.1...v0.30.0)

#### What's Changed

-   docs: clarify question on FAQ by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1087
-   feat: handle some false positives in let/lets/let's/let us by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1085
-   feat: have past→have passed by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1088
-   build(deps): bump clap from 4.5.36 to 4.5.37 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1093
-   feat: Australian English affix annotation `_` by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1094
-   fix: reset vscode version to `1.96.2` by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1084
-   Dictionary (and adj-of-a) curation 2025 04 18 by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1090
-   Updated `justfile` to check tests and benches by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1098
-   feat: worse-case scenario→worst-case scenario by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1104
-   docs(obsidian): wrote initial contributor's guide by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1105
-   feat: incase→in case by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1103
-   feat: adds a `t_ws()` shorthand for `then_whitespace()` in the spirit of `t_aco()` by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1115
-   feat: implement dialect indicator for Obsidian plugin by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1102
-   Fix Lua syntax in neovim example config by [@&#8203;nikosavola](https://github.com/nikosavola) in Automattic/harper#1110
-   feat: client's side→client-side, server's side→server side by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1109
-   fix(obsidian): console contamination by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1116
-   feat(core): add several novel rules by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1108

#### New Contributors

-   [@&#8203;nikosavola](https://github.com/nikosavola) made their first contribution in Automattic/harper#1110

**Full Changelog**: Automattic/harper@v0.29.1...v0.30.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNTcuOCIsInVwZGF0ZWRJblZlciI6IjQwLjEwLjQiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbIlJlbm92YXRlIEJvdCJdfQ==-->
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.

2 participants