Skip to content

Speed up inherited configuration resolution - #28299

Merged
charliermarsh merged 2 commits into
astral-sh:mainfrom
jogo-openai:jogo/codex/ruff-cache-globs-upstream
Sep 4, 2026
Merged

charliermarsh merged 2 commits into
astral-sh:mainfrom
jogo-openai:jogo/codex/ruff-cache-globs-upstream

Conversation

@jogo-openai

Copy link
Copy Markdown
Contributor

Summary

Projects that extend the same Ruff configuration repeatedly parse its
options and compile inherited per-file globs during file discovery.
Reuse that work within each traversal to reduce configuration overhead
when checking many projects.

Cache parsed and normalized configurations by file path and
normalization root, before inheritance merging and CLI overrides. Share
per-file glob compilation across configuration clones, preserving the
existing post-override compilation order and matching behavior. Reuse
path candidates during matching and skip empty per-file target-version
lookups.

The cache lasts for one traversal; later traversals reload
configurations. Parsing stays outside the cache lock so unrelated files
can load in parallel. Concurrent misses can load the same file more than
once.

Test Plan

Existing CLI and workspace regressions pass for inherited configuration
errors, relative paths, CLI overrides, negated per-file ignores, and
target versions for linting and formatting. No snapshots changed.

## Summary

Projects that extend the same Ruff configuration repeatedly parse its
options and compile inherited per-file globs during file discovery.
Reuse that work within each traversal to reduce configuration overhead
when checking many projects.

Cache parsed and normalized configurations by file path and
normalization root, before inheritance merging and CLI overrides. Share
per-file glob compilation across configuration clones, preserving the
existing post-override compilation order and matching behavior. Reuse
path candidates during matching and skip empty per-file target-version
lookups.

The cache lasts for one traversal; later traversals reload
configurations. Parsing stays outside the cache lock so unrelated files
can load in parallel. Concurrent misses can load the same file more than
once.

## Test Plan

Existing CLI and workspace regressions pass for inherited configuration
errors, relative paths, CLI overrides, negated per-file ignores, and
target versions for linting and formatting. No snapshots changed.
@astral-sh-bot

astral-sh-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh
charliermarsh merged commit 78eea89 into astral-sh:main Sep 4, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Potential performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants