ruff/python/ruff-ecosystem
Brent Westbrook 67602512b6
Recognize SyntaxError: as an error code for ecosystem checks (#16879)
Summary
--

This updates the regex in `ruff-ecosystem` to catch syntax errors in an
effort to prevent bugs like #16874. This should catch `ParseError`s,
`UnsupportedSyntaxError`s, and the upcoming `SemanticSyntaxError`s.

Test Plan
--

I ran the ecosystem check locally comparing v0.11.0 and v0.11.1 and saw
a large number (2757!) of new syntax errors. I also manually tested the
regex on a few lines before that.

If we merge this before #16878, I'd expect to see that number decrease
substantially in that PR too, as another test.
2025-03-20 17:25:40 -04:00
..
ruff_ecosystem Recognize SyntaxError: as an error code for ecosystem checks (#16879) 2025-03-20 17:25:40 -04:00
pyproject.toml Update dependency tomli_w to v1.2.0 (#15600) 2025-01-20 10:18:43 +05:30
README.md Use uv consistently throughout the documentation (#15302) 2025-01-07 14:43:25 +00:00

ruff-ecosystem

Compare lint and format results for two different ruff versions (e.g. main and a PR) on real world projects.

Installation

From the Ruff project root, install with uv:

uv tool install -e ./python/ruff-ecosystem

Usage

ruff-ecosystem <check | format> <baseline executable> <comparison executable>

Note executable paths may be absolute, relative to the current working directory, or will be looked up in the current Python environment and PATH.

Run ruff check ecosystem checks comparing your debug build to your system Ruff:

ruff-ecosystem check ruff "./target/debug/ruff"

Run ruff format ecosystem checks comparing your debug build to your system Ruff:

ruff-ecosystem format ruff "./target/debug/ruff"

Run ruff format ecosystem checks comparing with changes to code that is already formatted:

ruff-ecosystem format ruff "./target/debug/ruff" --format-comparison ruff-then-ruff

Run ruff format ecosystem checks comparing with the Black formatter:

ruff-ecosystem format black ruff -v --cache python/checkouts --format-comparison black-and-ruff

The default output format is markdown, which includes nice summaries of the changes. You can use --output-format json to display the raw data — this is particularly useful when making changes to the ecosystem checks.

Development

When developing, it can be useful to set the --pdb flag to drop into a debugger on failure:

ruff-ecosystem check ruff "./target/debug/ruff" --pdb

You can also provide a path to cache checkouts to speed up repeated runs:

ruff-ecosystem check ruff "./target/debug/ruff" --cache ./repos