Automattic / Automattic/harper
Add ability to test sub-linters of a merged linter
- Dominant language
- Rust
- Stars
- 15.4k
- Forks
- 627
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 106
Description
While testing out PR #3131 I wanted to try adding various extra tests.
The PR modifies only the `ToTooDegreeWords` sub-linter. The merged linter is called `ToTwoToo`. I tried running `harper-cli lint` with just the linter being worked on but ran into this: `Warning: Cannot enable unknown rule 'ToTooDegreeWords'.`
Oddly, while trying various things I found out that the `TooTo` sub-linter does not throw such a warning, but every other sub-linter does.
```
% cargo run \
--manifest-path harper-the-fourth/harper/Cargo.toml \
-p harper-cli \
-- lint --format default --only ToTooAdjectiveEnd,ToTooAdjectivePunct,ToTooAdverb,ToTooAdjVerbEdPunct,ToTooChunkStartComma,ToTooDegreeWords,ToTooPronounEnd,ToTooEos,TooTo harper/harper-core/tests/text harper-test readmine/readmes |& less -R
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.89s
Running `.hippietrail/cargo-harper-consumers/debug/harper-cli lint --format default --only ToTooAdjectiveEnd,ToTooAdjectivePunct,ToTooAdverb,ToTooAdjVerbEdPunct,ToTooChunkStartComma,ToTooDegreeWords,ToTooPronounEnd,ToTooEos,TooTo harper/harper-core/tests/text harper-test readmine/readmes`
Warning: Cannot enable unknown rule 'ToTooAdjectiveEnd'.
Warning: Cannot enable unknown rule 'ToTooAdjectivePunct'.
Warning: Cannot enable unknown rule 'ToTooAdverb'.
Warning: Cannot enable unknown rule 'ToTooAdjVerbEdPunct'.
Warning: Cannot enable unknown rule 'ToTooChunkStartComma'.
Warning: Cannot enable unknown rule 'ToTooDegreeWords'.
Warning: Cannot enable unknown rule 'ToTooPronounEnd'.
Warning: Cannot enable unknown rule 'ToTooEos'.
```
It should be possible to test individual sublinters of a merged linter using the `harper-cli` developers' debug tool.
Contributor guide
Research direction
Start at the harper-cli lint command and inspect how the --only rule names are registered and how merged linters expose their sub-linters. Reproduce the command from the issue, including ToTooDegreeWords and TooTo, then verify that each named sub-linter can be enabled without an unknown-rule warning and still runs through the developers' debug tool.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100