Automattic / Automattic/harper

Suggestions from at least certain pairs of linters should be combined

Open
#3,019 4 comments 2 reactions 0 assignees View on GitHub
enhancement harper-core linting spelling
Dominant language
Rust
Stars
15.4k
Forks
627
Avg merge
1d 15h
Merged PRs (30d)
102

Description

Here's a fairly typical typo for me. (My touchtyping seems to be degrading over the decades.)

Image

In this case a `SpellCheck` suggestion would've **_surely_** suggested the correct word, but I only got a less-than-useful suggestion from `SplitWords`. Sometimes the opposite happens.

In the past I'm pretty sure we used to see suggestions from multiple linters at once, at least in the Chrome extension. I assume this was disabled due it often being confusing and unhelpful.

But in some instances it is definitely the right thing to. Splitting words not in the dictionary and suggesting similarish single words from the dictionary for words not in the dictionary, are really similar when you think about it. There are fairly likely some other linters that might belong in this set too.

I can think of a few ways this might be improved:

- Maybe just changing the code that removes overlapping lints is enough? Some tweaking of lint priorities might be needed.
- Maybe a "layer" needs to be created where these two are handled in a special way that's somewhat apart from the other linters in some way.
- Maybe they need to be combined into a single linter somehow. This is actually easy to do a quick solution for by making a new "wrapper" linter that calls these two and manually combines the suggestions. I recently put out a PR that wraps the `SpellCheck` linter with one that doesn't flag username mentions by just filtering out suggestions with `@` in the right place. This is probably only suitable for a mockup.

Other ideas?

Contributor guide

Open the contributing guide

Research direction

Start by tracing how overlapping lints are removed and how the SpellCheck and SplitWords suggestions are produced. Compare the current behavior with the desired combined suggestions, then define focused cases and tests showing when both suggestions should be retained or combined.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.