Automattic / Automattic/harper

Implement a configuration file

Open
#147 6 comments 11 reactions 0 assignees View on GitHub
config-options-prefs-settings
Dominant language
Rust
Stars
15.4k
Forks
627
Avg merge
1d 15h
Merged PRs (30d)
106

Description

If I'm not mistaken, all possible configuration of Harper goes through the used editor and passed onto `harper-ls`. While this works for single-user, non-shared, in-editor consumption, it does not allow for out-of-editor nor shared use, for example when wanting to run the tool on a code-base multiple people work on regularly, without forcing a particular editor to be used, and ensuring prolonged correctness with CI.

A potential solution for this would be to have a common file that enables configuring the tool. This would be very similar to what many other such tools have, such as EditorConfig, Cargo, Clippy, Rustfmt, `ast-grep`, `cargo-deny`, `cargo-about`, ... which should thus feel a bit more intuitive.

The file would enable configuring both `harper-ls` and `harper-cli`. This way, both in- and out-of- editor results would be identical. It would also be an opportunity to add a good chunk of functionality to `harper-cli` that currently lacks any form of configuration whatsoever if I'm not mistaken.

A precedence system should also be implemented with it, so that a common base may be shared between multiple users and checked in CI, but each user may further customize things at their discretion, similarly to what you may obtain with Rust Analyzer and your usual Rust environment. In order:
* CLI arguments;
* environment;
* editor configuration;
* local configuration: current directory, then parent, then grandparent, etc;
* user configuration;
* built-in defaults;

As an MVP however, this could only start with the editor configuration, the local configuration and the built-in defaults. It could even be shifted to a second step entirely by only using the local configuration if it is present or the editor one otherwise.

`harper.toml` should be a good candidate for its name and format.

Contributor guide

Open the contributing guide

Research direction

Start by locating the configuration entry points for harper-ls and harper-cli, then compare how editor settings and CLI arguments currently enter each component. Define the MVP around harper.toml, local or editor configuration, and built-in defaults; done means both tools use the shared configuration and produce identical results.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.