astral-sh/ruff
By the numbers
Data collected on 2026-04-30 from a clone of main at commit b3fb864847.
Size
The codebase is dominated by Rust. There is also a small TypeScript/JS playground frontend, a Python script collection, and a sizeable corpus of Python fixture files used by snapshot and mdtest harnesses.
xychart-beta horizontal
title "Lines of source code by language"
x-axis ["Rust", "Python (fixtures)", "Markdown (mdtest)", "TypeScript/JS"]
y-axis "Lines" 0 --> 700000
bar [650697, 220000, 80000, 12000](Rust LOC is exact; Python/Markdown/TS are approximate, dominated by fixtures.)
| Metric | Value |
|---|---|
| Total Rust files | 1,829 |
| Total Rust LOC | 650,697 |
| Workspace crates | 49 |
| Lint rules implemented | 900+ |
Rule plugin directories under ruff_linter/src/rules/ |
60 |
Top-level docs pages (docs/) |
14 sections |
| Generated config schemas | 2 (ruff.schema.json, ty.schema.json) |
Crate footprint (selected)
| Crate | Purpose | Approx. role |
|---|---|---|
ruff_linter |
All 900+ lint rules + per-pass checkers | Largest single crate |
ruff_python_formatter |
Code formatter | Heavyweight |
ruff_python_parser |
Handwritten Python parser | Heavyweight |
ty_python_semantic |
Type system, inference, type-checks | Largest ty crate |
ty_vendored |
Bundled typeshed stubs | Mostly data |
ruff_python_ast |
Typed AST + visitors | Foundational |
ruff_workspace |
Configuration plumbing | Foundational |
ruff_db |
File system / Salsa primitives | Foundational |
Activity
xychart-beta horizontal
title "Commits per month (recent)"
x-axis ["2025-10", "2025-11", "2025-12", "2026-01", "2026-02", "2026-03", "2026-04"]
y-axis "Commits" 0 --> 500
bar [314, 348, 435, 451, 442, 421, 379]| Window | Commits |
|---|---|
| 2022 (project start) | 1,407 |
| 2023 | 4,571 |
| 2024 | 2,966 |
| 2025 | 4,480 |
| 2026 (Jan–Apr) | 1,693 |
| All time | 15,117 |
The 2025 spike correlates with the merge of the ty codebase (renamed from red_knot) into mainline development and a sustained burst of type-checker work.
Bot-attributed commits
A lower bound on automation footprint, based on author/co-author markers in git log:
| Pattern | Count |
|---|---|
dependabot[bot] (dependency bumps) |
regular weekly cadence — see .github/renovate.json for rules |
github-actions[bot] (workflow commits) |
small, mostly auto-merged |
factory-droid[bot] / copilot[bot] co-authorship |
none observed in main history |
Inline AI-assisted edits are not represented in commit metadata. Astral has a public AI policy at https://github.com/astral-sh/.github/blob/main/AI_POLICY.md that contributors must follow.
Test surface
| Test type | Where it lives | How it runs |
|---|---|---|
insta snapshot tests |
next to source (*.snap files in snapshots/) |
cargo nextest run, accept with cargo insta accept |
mdtest Markdown fixtures (ty) |
crates/ty_python_semantic/resources/mdtest/**/*.md |
cargo nextest run -p ty_python_semantic |
| Integration / corpus tests | crates/ruff_linter/resources/test/fixtures/, crates/ruff_python_formatter/tests/, etc. |
cargo nextest run |
| Fuzz targets | fuzz/ |
cargo fuzz run … |
| Round-trip parser test | cargo dev round-trip |
manual |
Test-to-code ratio
Snapshots and fixtures occupy roughly half the on-disk size of the workspace. The Markdown mdtest format is a deliberate choice to keep ty test cases readable and reviewable as documentation.
Dependency surface
The lockfile (Cargo.lock) is 134 KB. Direct workspace dependencies declared in Cargo.toml include salsa, clap, rayon, serde, tokio (LSP only), tower-lsp (LSP only), mdcat/pulldown-cmark (mdtest), tree-sitter (some helpers), and a custom fork of annotate-snippets.
See reference/dependencies for the full picture.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.