astral-sh / astral-sh/ruff

Meta issue: plugin system

Open
#283 94 comments 378 reactions 0 assignees View on GitHub
core
Dominant language
Rust
Stars
49.6k
Forks
2.4k
Avg merge
1d 21h
Merged PRs (30d)
435

Description

I think that the main thing why Flake8 is so popular is its plugin system.
You can find plugins for every possible type of problems and tools.

Right now docs state:

```
Beyond rule-set parity, ruff suffers from the following limitations vis-à-vis Flake8:

1. Flake8 has a plugin architecture and supports writing custom lint rules.
```

I propose designing and implementing plugin API.
This way `ruff` can compete with `flake8` in terms of adoption and usability.

## Plugin API

I think that there are some flake8 problems that should be fixed and also there are some unique chalenges that should be addressed.

1. Explicit "opt-in" for plugins. Right now `flake8` suffers from a problem when you install some tool and it has a `flake8` plugin definition. This plugin is automatically enabled due to how `setuptools` hooks work. I think that all rules must be explicit. So, `eslint`'s explicit `plugins:` looks like a better way.
2. Special "fix" API and tooling: so many typical problems can be solved easily by plugin authors
3. Plugin order. Since plugins will change the source code, we must be very strict about what order they run in. Do they run in parallel while checking files?
4. Plugin configuration: current way of configuring everything in `[flake8]` section can cause conflicts between plugins. Probably, the way `eslint` does that is better
5. Packaging: how to buld and package rust extensions? How to build wheels?

Please, share your ideas and concerns.

Contributor guide

Open the contributing guide

Research direction

Review the documented Flake8 limitation and the issue's Plugin API questions, then examine the contrasting approaches from eslint, setuptools hooks, and Flake8's [flake8] configuration. Done means an agreed and implemented design covering explicit opt-in, fixes, ordering, configuration, and Rust-extension packaging.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.