mirror of
https://github.com/astral-sh/ruff
synced 2026-01-22 14:00:51 -05:00
* Generate fixes when using --show-fixes
Example command: `cargo run --bin ruff -- --no-cache --select F401
--show-source --show-fixes
crates/ruff/resources/test/fixtures/pyflakes/F401_9.py`
Before, `--show-fixes` was ignored:
```
crates/ruff/resources/test/fixtures/pyflakes/F401_9.py:4:22: F401 [*] `foo.baz` imported but unused
|
4 | __all__ = ("bar",)
5 | from foo import bar, baz
| ^^^ F401
|
= help: Remove unused import: `foo.baz`
Found 1 error.
[*] 1 potentially fixable with the --fix option.
```
After:
```
crates/ruff/resources/test/fixtures/pyflakes/F401_9.py:4:22: F401 [*] `foo.baz` imported but unused
|
4 | __all__ = ("bar",)
5 | from foo import bar, baz
| ^^^ F401
|
= help: Remove unused import: `foo.baz`
ℹ Suggested fix
1 1 | """Test: late-binding of `__all__`."""
2 2 |
3 3 | __all__ = ("bar",)
4 |-from foo import bar, baz
4 |+from foo import bar
Found 1 error.
[*] 1 potentially fixable with the --fix option.
```
* Add `--format ecosystem-ci`
* cargo dev generate-all
* Put behind cargo feature
* Regenerate docs
* Don't test ecosystem_ci feature on CI
* Use top level flag instead
* Fix
* Simplify code based on #4191
* Remove old TODO comment
28 lines
1.2 KiB
Docker
28 lines
1.2 KiB
Docker
# [crater](https://github.com/rust-lang/crater)-inspired check that tests against a large number of
|
|
# projects, mainly from https://github.com/akx/ruff-usage-aggregate.
|
|
#
|
|
# We run this in a Docker container as Ruff isn't designed for untrusted inputs.
|
|
#
|
|
# Either download https://github.com/akx/ruff-usage-aggregate/blob/master/data/known-github-tomls.jsonl as
|
|
# `github_search.jsonl` or follow the instructions in the README to scrape your own dataset.
|
|
#
|
|
# Setup:
|
|
# ```
|
|
# apt-get install musl-tools # or corresponding command to install musl on your platform, e.g. `yay musl`
|
|
# rustup target add x86_64-unknown-linux-musl
|
|
# ```
|
|
# From the project root:
|
|
# ```
|
|
# cargo build --target x86_64-unknown-linux-musl --features ecosystem_ci
|
|
# docker buildx build -f scripts/Dockerfile.ecosystem -t ruff-ecosystem-checker --load .
|
|
# docker run --rm -v ./target/x86_64-unknown-linux-musl/debug/ruff:/app/ruff-new -v ./ruff-old:/app/ruff-old ruff-ecosystem-checker
|
|
# ```
|
|
|
|
FROM python:3.11
|
|
RUN mkdir /app
|
|
WORKDIR /app
|
|
ADD scripts/check_ecosystem.py check_ecosystem.py
|
|
ADD github_search.jsonl github_search.jsonl
|
|
|
|
CMD ["python", "check_ecosystem.py", "--verbose", "--projects", "github_search.jsonl", "ruff-new", "ruff-old"]
|