Rename cache variable; update clone type

This commit is contained in:
Zanie
2023-10-27 12:29:00 -05:00
parent a16c04c6db
commit 05ab316609
3 changed files with 7 additions and 9 deletions

View File

@@ -50,7 +50,7 @@ def entrypoint():
ruff_comparison_executable=args.ruff_comparison,
targets=DEFAULT_TARGETS,
format=OutputFormat(args.output_format),
cache=Path(cache),
project_dir=Path(cache),
raise_on_failure=args.pdb,
)
)

View File

@@ -28,7 +28,7 @@ async def main(
ruff_baseline_executable: Path,
ruff_comparison_executable: Path,
targets: list[Project],
cache: Path | None,
project_dir: Path,
format: OutputFormat,
max_parallelism: int = 50,
raise_on_failure: bool = False,
@@ -36,7 +36,7 @@ async def main(
logger.debug("Using command %s", command.value)
logger.debug("Using baseline executable at %s", ruff_baseline_executable)
logger.debug("Using comparison executable at %s", ruff_comparison_executable)
logger.debug("Using cache directory %s", cache)
logger.debug("Using checkout_dir directory %s", project_dir)
logger.debug("Checking %s targets", len(targets))
# Limit parallelism to avoid high memory consumption
@@ -54,7 +54,7 @@ async def main(
ruff_baseline_executable,
ruff_comparison_executable,
target,
cache,
project_dir,
)
)
for target in targets
@@ -95,7 +95,7 @@ async def clone_and_compare(
ruff_baseline_executable: Path,
ruff_comparison_executable: Path,
target: Project,
cache: Path,
project_dir: Path,
) -> Comparison:
"""Check a specific repository against two versions of ruff."""
assert ":" not in target.repo.owner
@@ -115,7 +115,7 @@ async def clone_and_compare(
case _:
raise ValueError(f"Unknown target Ruff command {command}")
checkout_dir = cache.joinpath(f"{target.repo.owner}:{target.repo.name}")
checkout_dir = project_dir.joinpath(f"{target.repo.owner}:{target.repo.name}")
cloned_repo = await target.repo.clone(checkout_dir)
try:

View File

@@ -55,9 +55,7 @@ class Repository(Serializable):
def url(self: Self) -> str:
return f"https://github.com/{self.owner}/{self.name}"
async def clone(
self: Self, checkout_dir: Path
) -> AsyncGenerator[ClonedRepository, None]:
async def clone(self: Self, checkout_dir: Path) -> ClonedRepository:
"""
Shallow clone this repository
"""