Automattic / Automattic/harper
False positive: `DoToDueTo` flags "do to" when followed by a multi-word verb whose first word is not a verb
- Dominant language
- Rust
- Stars
- 15.4k
- Forks
- 627
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 106
Description
> If there is anything I can do to beta test a Mac or Windows version, ...
I've added "beta test" and "beta-test" to the dictionary in the next upcoming dictionary curation.
There's two ways to address this that come to mind:
1. Add dictionary requirement to `DoToDueTo` and add a custom closure to the `Expr`/`Pattern` that looks up the three tokens (including separator) when the single token is not a verb lemma.
2. Add a new method to `SequenceExpr` `.then_two_part_verb()` or similar that can be reused in other linters. That name isn't ideal though as some multi-word verbs might consist of other components than "non-verb followed by verb" patterns. This would obviate the need to pass a dictionary to the linter.
----
Oh it turns out this linter is written in Weir. And a pretty complicated one.
I'm not good at complex Weir. I don't think the methods I outlined above are directly implementable in Weir.
The other solution would be to have a smaller Rust linter to catch edge cases Weir can't handle. But that would only work for false negatives. In a false positive, something is already marked as an error and we don't have a way for a second linter to unmark an error marked by another linter.
Contributor guide
Research direction
Start with the DoToDueTo linter and the Weir Expr/Pattern and SequenceExpr APIs mentioned in the report. Reproduce the quoted “beta test” false positive, then determine whether an approach can distinguish a multi-word verb whose first token is not a verb. Done means the false positive is no longer reported without regressing existing linter behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100