Allow config-file overrides in ecosystem checks (#9286)

Adds the ability to override `ruff.toml` or `pyproject.toml` settings
per-project during ecosystem checks.

Exploring this as a fix for the `setuptools` project error. 

Also useful for including Jupyter Notebooks in the ecosystem checks, see
#9293

Note the remaining `sphinx` project error is resolved in #9294
This commit is contained in:
Zanie Blue 2023-12-28 10:44:50 -06:00 committed by GitHub
parent f8fc309855
commit 57b6a8cedd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 210 additions and 60 deletions

View file

@ -28,7 +28,12 @@ from ruff_ecosystem.types import (
)
if TYPE_CHECKING:
from ruff_ecosystem.projects import CheckOptions, ClonedRepository, Project
from ruff_ecosystem.projects import (
CheckOptions,
ClonedRepository,
ConfigOverrides,
Project,
)
# Matches lines that are summaries rather than diagnostics
@ -477,25 +482,27 @@ async def compare_check(
ruff_baseline_executable: Path,
ruff_comparison_executable: Path,
options: CheckOptions,
config_overrides: ConfigOverrides,
cloned_repo: ClonedRepository,
) -> Comparison:
async with asyncio.TaskGroup() as tg:
baseline_task = tg.create_task(
ruff_check(
executable=ruff_baseline_executable.resolve(),
path=cloned_repo.path,
name=cloned_repo.fullname,
options=options,
),
)
comparison_task = tg.create_task(
ruff_check(
executable=ruff_comparison_executable.resolve(),
path=cloned_repo.path,
name=cloned_repo.fullname,
options=options,
),
)
with config_overrides.patch_config(cloned_repo.path, options.preview):
async with asyncio.TaskGroup() as tg:
baseline_task = tg.create_task(
ruff_check(
executable=ruff_baseline_executable.resolve(),
path=cloned_repo.path,
name=cloned_repo.fullname,
options=options,
),
)
comparison_task = tg.create_task(
ruff_check(
executable=ruff_comparison_executable.resolve(),
path=cloned_repo.path,
name=cloned_repo.fullname,
options=options,
),
)
baseline_output, comparison_output = (
baseline_task.result(),