mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:25:17 +00:00

Closes #7239 - Refactors `scripts/check_ecosystem.py` into a new Python project at `python/ruff-ecosystem` - Includes [documentation](https://github.com/astral-sh/ruff/blob/zanie/ecosystem-format/python/ruff-ecosystem/README.md) now - Provides a `ruff-ecosystem` CLI - Fixes bug where `ruff check` report included "fixable" summary line - Adds truncation to `ruff check` reports - Otherwise we often won't see the `ruff format` reports - The truncation uses some very simple heuristics and could be improved in the future - Identifies diagnostic changes that occur just because a violation's fix available changes - We still show the diff for the line because it's could matter _where_ this changes, but we could improve this - Similarly, we could improve detection of diagnostic changes where just the message changes - Adds support for JSON ecosystem check output - I added this primarily for development purposes - If there are no changes, only errors while processing projects, we display a different summary message - When caching repositories, we now checkout the requested ref - Adds `ruff format` reports, which format with the baseline then the use `format --diff` to generate a report - Runs all CI jobs when the CI workflow is changed ## Known problems - Since we must format the project to get a baseline, the permalink line numbers do not exactly correspond to the correct range - This looks... hard. I tried using `git diff` and some wonky hunk matching to recover the original line numbers but it doesn't seem worth it. I think we should probably commit the formatted changes to a fork or something if we want great results here. Consequently, I've just used the start line instead of a range for now. - I don't love the comment structure — it'd be nice, perhaps, to have separate headings for the linter and formatter. - However, the `pr-comment` workflow is an absolute pain to change because it runs _separately_ from this pull request so I if I want to make edits to it I can only test it via manual workflow dispatch. - Lines are not printed "as we go" which means they're all held in memory, presumably this would be a problem for large-scale ecosystem checks - We are encountering a hard limit with the maximum comment length supported by GitHub. We will need to move the bulk of the report elsewhere. ## Future work - Update `ruff-ecosystem` to support non-default projects and `check_ecosystem_all.py` behavior - Remove existing ecosystem check scripts - Add preview mode toggle (#8076) - Add a toggle for truncation - Add hints for quick reproduction of runs locally - Consider parsing JSON output of Ruff instead of using regex to parse the text output - Links to project repositories should use the commit hash we checked against - When caching repositories, we should pull the latest changes for the ref - Sort check diffs by path and rule code only (changes in messages should not change order) - Update check diffs to distinguish between new violations and changes in messages - Add "fix" diffs - Remove existing formatter similarity reports - On release pull request, compare to the previous tag instead --------- Co-authored-by: konsti <konstin@mailbox.org>
73 lines
3.8 KiB
Python
73 lines
3.8 KiB
Python
"""
|
|
Default projects for ecosystem checks
|
|
"""
|
|
from ruff_ecosystem.projects import CheckOptions, FormatOptions, Project, Repository
|
|
|
|
# TODO(zanieb): Consider exporting this as JSON and loading from there instead
|
|
DEFAULT_TARGETS = [
|
|
Project(repo=Repository(owner="DisnakeDev", name="disnake", ref="master")),
|
|
Project(repo=Repository(owner="PostHog", name="HouseWatch", ref="main")),
|
|
Project(repo=Repository(owner="RasaHQ", name="rasa", ref="main")),
|
|
Project(repo=Repository(owner="Snowflake-Labs", name="snowcli", ref="main")),
|
|
Project(repo=Repository(owner="aiven", name="aiven-client", ref="main")),
|
|
Project(repo=Repository(owner="alteryx", name="featuretools", ref="main")),
|
|
Project(
|
|
repo=Repository(owner="apache", name="airflow", ref="main"),
|
|
check_options=CheckOptions(select="ALL"),
|
|
),
|
|
Project(repo=Repository(owner="aws", name="aws-sam-cli", ref="develop")),
|
|
Project(repo=Repository(owner="bloomberg", name="pytest-memray", ref="main")),
|
|
Project(
|
|
repo=Repository(owner="bokeh", name="bokeh", ref="branch-3.3"),
|
|
check_options=CheckOptions(select="ALL"),
|
|
),
|
|
Project(repo=Repository(owner="commaai", name="openpilot", ref="master")),
|
|
Project(
|
|
repo=Repository(owner="demisto", name="content", ref="master"),
|
|
format_options=FormatOptions(
|
|
# Syntax errors in this file
|
|
exclude="Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py"
|
|
),
|
|
),
|
|
Project(repo=Repository(owner="docker", name="docker-py", ref="main")),
|
|
Project(repo=Repository(owner="freedomofpress", name="securedrop", ref="develop")),
|
|
Project(repo=Repository(owner="fronzbot", name="blinkpy", ref="dev")),
|
|
Project(repo=Repository(owner="ibis-project", name="ibis", ref="master")),
|
|
Project(repo=Repository(owner="ing-bank", name="probatus", ref="main")),
|
|
Project(repo=Repository(owner="jrnl-org", name="jrnl", ref="develop")),
|
|
Project(repo=Repository(owner="latchbio", name="latch", ref="main")),
|
|
Project(repo=Repository(owner="lnbits", name="lnbits", ref="main")),
|
|
Project(repo=Repository(owner="milvus-io", name="pymilvus", ref="master")),
|
|
Project(repo=Repository(owner="mlflow", name="mlflow", ref="master")),
|
|
Project(repo=Repository(owner="model-bakers", name="model_bakery", ref="main")),
|
|
Project(repo=Repository(owner="pandas-dev", name="pandas", ref="main")),
|
|
Project(repo=Repository(owner="prefecthq", name="prefect", ref="main")),
|
|
Project(repo=Repository(owner="pypa", name="build", ref="main")),
|
|
Project(repo=Repository(owner="pypa", name="cibuildwheel", ref="main")),
|
|
Project(repo=Repository(owner="pypa", name="pip", ref="main")),
|
|
Project(repo=Repository(owner="pypa", name="setuptools", ref="main")),
|
|
Project(repo=Repository(owner="python", name="mypy", ref="master")),
|
|
Project(
|
|
repo=Repository(
|
|
owner="python",
|
|
name="typeshed",
|
|
ref="main",
|
|
),
|
|
check_options=CheckOptions(select="PYI"),
|
|
),
|
|
Project(repo=Repository(owner="python-poetry", name="poetry", ref="master")),
|
|
Project(repo=Repository(owner="reflex-dev", name="reflex", ref="main")),
|
|
Project(repo=Repository(owner="rotki", name="rotki", ref="develop")),
|
|
Project(repo=Repository(owner="scikit-build", name="scikit-build", ref="main")),
|
|
Project(
|
|
repo=Repository(owner="scikit-build", name="scikit-build-core", ref="main")
|
|
),
|
|
Project(repo=Repository(owner="sphinx-doc", name="sphinx", ref="master")),
|
|
Project(repo=Repository(owner="spruceid", name="siwe-py", ref="main")),
|
|
Project(repo=Repository(owner="tiangolo", name="fastapi", ref="master")),
|
|
Project(repo=Repository(owner="yandex", name="ch-backup", ref="main")),
|
|
Project(
|
|
repo=Repository(owner="zulip", name="zulip", ref="main"),
|
|
check_options=CheckOptions(select="ALL"),
|
|
),
|
|
]
|