mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Don't assume unique repo names in ecosystem checks (#4628)
This fixes a bug where previously repositories with the same name would have been overwritten. I tested with `scripts/check_ecosystem.py -v --checkouts target/checkouts_main .venv/bin/ruff target/release/ruff` and ruff 0.0.267 that changes are shown. I confirmed with `scripts/ecosystem_all_check.sh check --select RUF008` (next PR) that the checkouts are now complete.
This commit is contained in:
parent
040fb9cef4
commit
30e90838d0
1 changed files with 23 additions and 21 deletions
|
@ -71,24 +71,26 @@ class Repository(NamedTuple):
|
||||||
|
|
||||||
process = await create_subprocess_exec(*git_command)
|
process = await create_subprocess_exec(*git_command)
|
||||||
|
|
||||||
await process.wait()
|
status_code = await process.wait()
|
||||||
|
|
||||||
logger.debug(f"Finished cloning {self.org}/{self.repo}")
|
logger.debug(
|
||||||
|
f"Finished cloning {self.org}/{self.repo} with status {status_code}",
|
||||||
|
)
|
||||||
|
|
||||||
yield Path(checkout_dir)
|
yield Path(checkout_dir)
|
||||||
|
|
||||||
|
|
||||||
REPOSITORIES = {
|
REPOSITORIES: list[Repository] = [
|
||||||
"airflow": Repository("apache", "airflow", "main", select="ALL"),
|
Repository("apache", "airflow", "main", select="ALL"),
|
||||||
"bokeh": Repository("bokeh", "bokeh", "branch-3.2", select="ALL"),
|
Repository("bokeh", "bokeh", "branch-3.2", select="ALL"),
|
||||||
"build": Repository("pypa", "build", "main"),
|
Repository("pypa", "build", "main"),
|
||||||
"cibuildwheel": Repository("pypa", "cibuildwheel", "main"),
|
Repository("pypa", "cibuildwheel", "main"),
|
||||||
"disnake": Repository("DisnakeDev", "disnake", "master"),
|
Repository("DisnakeDev", "disnake", "master"),
|
||||||
"scikit-build": Repository("scikit-build", "scikit-build", "main"),
|
Repository("scikit-build", "scikit-build", "main"),
|
||||||
"scikit-build-core": Repository("scikit-build", "scikit-build-core", "main"),
|
Repository("scikit-build", "scikit-build-core", "main"),
|
||||||
"typeshed": Repository("python", "typeshed", "main", select="PYI"),
|
Repository("python", "typeshed", "main", select="PYI"),
|
||||||
"zulip": Repository("zulip", "zulip", "main", select="ALL"),
|
Repository("zulip", "zulip", "main", select="ALL"),
|
||||||
}
|
]
|
||||||
|
|
||||||
SUMMARY_LINE_RE = re.compile(r"^(Found \d+ error.*)|(.*potentially fixable with.*)$")
|
SUMMARY_LINE_RE = re.compile(r"^(Found \d+ error.*)|(.*potentially fixable with.*)$")
|
||||||
|
|
||||||
|
@ -222,7 +224,7 @@ async def compare(
|
||||||
return Diff(removed, added)
|
return Diff(removed, added)
|
||||||
|
|
||||||
|
|
||||||
def read_projects_jsonl(projects_jsonl: Path) -> dict[str, Repository]:
|
def read_projects_jsonl(projects_jsonl: Path) -> dict[tuple[str, str], Repository]:
|
||||||
"""Read either of the two formats of https://github.com/akx/ruff-usage-aggregate."""
|
"""Read either of the two formats of https://github.com/akx/ruff-usage-aggregate."""
|
||||||
repositories = {}
|
repositories = {}
|
||||||
for line in projects_jsonl.read_text().splitlines():
|
for line in projects_jsonl.read_text().splitlines():
|
||||||
|
@ -241,7 +243,7 @@ def read_projects_jsonl(projects_jsonl: Path) -> dict[str, Repository]:
|
||||||
# us the revision, but there's no way with git to just do
|
# us the revision, but there's no way with git to just do
|
||||||
# `git clone --depth 1` with a specific ref.
|
# `git clone --depth 1` with a specific ref.
|
||||||
# `ref = item["url"].split("?ref=")[1]` would be exact
|
# `ref = item["url"].split("?ref=")[1]` would be exact
|
||||||
repositories[repository["name"]] = Repository(
|
repositories[(repository["owner"], repository["repo"])] = Repository(
|
||||||
repository["owner"]["login"],
|
repository["owner"]["login"],
|
||||||
repository["name"],
|
repository["name"],
|
||||||
None,
|
None,
|
||||||
|
@ -254,7 +256,7 @@ def read_projects_jsonl(projects_jsonl: Path) -> dict[str, Repository]:
|
||||||
# Pick only the easier case for now.
|
# Pick only the easier case for now.
|
||||||
if data["path"] != "pyproject.toml":
|
if data["path"] != "pyproject.toml":
|
||||||
continue
|
continue
|
||||||
repositories[data["repo"]] = Repository(
|
repositories[(data["owner"], data["repo"])] = Repository(
|
||||||
data["owner"],
|
data["owner"],
|
||||||
data["repo"],
|
data["repo"],
|
||||||
data.get("ref"),
|
data.get("ref"),
|
||||||
|
@ -276,7 +278,7 @@ async def main(
|
||||||
if projects_jsonl:
|
if projects_jsonl:
|
||||||
repositories = read_projects_jsonl(projects_jsonl)
|
repositories = read_projects_jsonl(projects_jsonl)
|
||||||
else:
|
else:
|
||||||
repositories = REPOSITORIES
|
repositories = {(repo.org, repo.repo): repo for repo in REPOSITORIES}
|
||||||
|
|
||||||
logger.debug(f"Checking {len(repositories)} projects")
|
logger.debug(f"Checking {len(repositories)} projects")
|
||||||
|
|
||||||
|
@ -306,11 +308,11 @@ async def main(
|
||||||
print(f"\u2139\ufe0f ecosystem check **detected changes**. {changes}")
|
print(f"\u2139\ufe0f ecosystem check **detected changes**. {changes}")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
for name, diff in diffs.items():
|
for (org, repo), diff in diffs.items():
|
||||||
if isinstance(diff, Exception):
|
if isinstance(diff, Exception):
|
||||||
changes = "error"
|
changes = "error"
|
||||||
print(f"<details><summary>{name} ({changes})</summary>")
|
print(f"<details><summary>{repo} ({changes})</summary>")
|
||||||
repo = repositories[name]
|
repo = repositories[(org, repo)]
|
||||||
print(
|
print(
|
||||||
f"https://github.com/{repo.org}/{repo.repo} ref {repo.ref} "
|
f"https://github.com/{repo.org}/{repo.repo} ref {repo.ref} "
|
||||||
f"select {repo.select} ignore {repo.ignore} exclude {repo.exclude}",
|
f"select {repo.select} ignore {repo.ignore} exclude {repo.exclude}",
|
||||||
|
@ -327,7 +329,7 @@ async def main(
|
||||||
print("</details>")
|
print("</details>")
|
||||||
elif diff:
|
elif diff:
|
||||||
changes = f"+{len(diff.added)}, -{len(diff.removed)}"
|
changes = f"+{len(diff.added)}, -{len(diff.removed)}"
|
||||||
print(f"<details><summary>{name} ({changes})</summary>")
|
print(f"<details><summary>{repo} ({changes})</summary>")
|
||||||
print("<p>")
|
print("<p>")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue