Automattic / Automattic/harper

Add a "find linter" or "grep linter" command to `harper-cli`

Open
#3,716 0 comments 0 reactions 0 assignees View on GitHub
enhancement harper-cli
Dominant language
Rust
Stars
15.4k
Forks
627
Avg merge
1d 15h
Merged PRs (30d)
106

Description

Sometimes a new linter could actually just be a modification to an existing linter.
Sometimes a new linter solves the same problem in a different context, and makes sense to have separate logic, but could take part in a new "merged linter" with an existing one.

But when starting work on a new linter it's not always easy to know if an existing linter is closely related enough to what you're implementing. Because we have:

- Rust linters in `/src/linting/*.rs`
- Weir linters in `/src/linting/weir_rules/*.weir`
- Phrase set corrections in `/src/linting/phrase_set_corrections/mod.rs`
- Merged rust linters in `/src/linting/*/†.rs`

It would be handy to have a tool that a contributor could use to grep all of these for keywords to see if something related to their idea exists that they can add to.

For instance if you want to make a new linter that fixes a mixup between "worse" and "worst", you might not realize there are already:
- 15 subrules as `WorseOrWorst` in `phrase_set_corrections`
- `LessWorse` as a Rust linter.
- `WorstCaseScenario` as a Weir linter

You might still have reason to make a separate linter but it would be a more informed decision. Or this might make you see that you were about to add your fix into one linter where another one would've been a better fit.

Contributor guide

Open the contributing guide

Research direction

Start by locating the harper-cli command entry point, then inspect the linter sources under /src/linting/*.rs, /src/linting/weir_rules/*.weir, /src/linting/phrase_set_corrections/mod.rs, and merged linter directories. The command should search these sources for contributor-supplied keywords and report related linters across all categories.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.