Commit Graph
169 Commits
Author SHA1 Message Date
Micha Reiser fbd7105794 Document Python arena storage, traversal and node identity
Describe how borrowed handles, retained references, rewriters and
parser allocation work together.
2026-11-30 16:36:39 +00:00
Ee Durbin 7be0f442ff Trigger the VS Code extension release after stable Ruff releases (#30413)
After each stable Ruff release, the downstream notifier starts
`ruff-vscode`’s `release-prepare.yml` with the released version and
`auto-promote=true`. The extension merges its version bump after CI and
waits for approval before marketplace publication.

Merge
[ruff-vscode#1256](https://github.com/astral-sh/ruff-vscode/pull/1256)
first.
2026-11-17 16:31:01 -05:00
David Peter db6e238c40 Infer the Ruff release tag from the crate version (#30494)
## Summary

Follow [uv’s release
workflow](https://github.com/astral-sh/uv/pull/19477) and [ty’s release
workflow](https://github.com/astral-sh/ty/pull/5014) by deriving the
GitHub release tag from the checked-out version. Ruff reads the
Cargo-style version from `crates/ruff/Cargo.toml` so prerelease tags
retain their existing format.
2026-11-17 16:57:31 +01:00
zaniebotandZanie Blue c23d6967c9 Clarify documentation and correct stale guidance (#29374)
The documentation has stale configuration guidance and a few examples
that do not work as written. Clarify the prose and correct editor
configuration precedence, user-level configuration discovery, rule
descriptions, and the tutorial and configuration examples.

---------

Co-authored-by: Zanie Blue <zanie@openai.com>
2026-10-15 13:36:53 -05:00
Brent Westbrook 8f362bf4cb Integrate vendored Unicode names into Ruff
Use the vendored runtime and generator instead of the registry dependency,
providing Unicode 17 names with Python-compatible matching. Update workspace
dependencies and tool configuration, add parser regressions, and document how
to update Unicode data when supporting a new Python version.
2026-10-09 12:26:57 -04:00
David Peter db2a4a9216 [ty] Upgrade hyperfine to 2.0.0-alpha.2 for benchmarks (#29151)
## Summary

Upgrade hyperfine to 2.0.0-alpha.2, which now includes support for
memory measurements (see output below).

Tested:

<details>
<summary>Formatter benchmark output</summary>

```text
Benchmark 1: ./target/release/ruff format ./fixture (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     12.8 ms  ±     0.2 ms      12.7 ms  …    12.9 ms
  Memory        16.6 MiB ±     0.1 MiB     16.5 MiB …    16.6 MiB
 
Benchmark 2: black --no-cache ./fixture --safe (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    207.1 ms  ±     4.8 ms     203.7 ms  …   210.5 ms         +1517.9%  (16.2x slower)
  Memory        37.3 MiB ±     0.1 MiB     37.2 MiB …    37.4 MiB         +125.2%  (2.3x more)
 
Benchmark 3: black --no-cache ./fixture --fast (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    226.6 ms  ±     7.4 ms     221.4 ms  …   231.9 ms         +1670.7%  (17.7x slower)
  Memory        37.4 MiB ±     0.1 MiB     37.3 MiB …    37.5 MiB         +126.2%  (2.3x more)
 
Benchmark 4: black --no-cache ./fixture --safe --preview (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    250.1 ms  ±    41.8 ms     220.6 ms  …   279.6 ms         +1854.3%  (19.5x slower)
  Memory        37.4 MiB ±     0.3 MiB     37.2 MiB …    37.6 MiB         +126.0%  (2.3x more)
 
Benchmark 5: black --no-cache ./fixture --fast --preview (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    186.2 ms  ±     2.5 ms     184.5 ms  …   188.0 ms         +1355.1%  (14.6x slower)
  Memory        37.3 MiB ±     0.0 MiB     37.3 MiB …    37.3 MiB         +125.2%  (2.3x more)
 
Benchmark 6: autopep8 ./fixture --recursive --in-place (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     41.6 ms  ±     0.7 ms      41.1 ms  …    42.1 ms          +225.2%  (3.3x slower)
  Memory        26.3 MiB ±     0.0 MiB     26.3 MiB …    26.3 MiB          +58.8%  (1.6x more)
 
Benchmark 7: yapf ./fixture --parallel --recursive --in-place (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    142.1 ms  ±     4.8 ms     138.7 ms  …   145.5 ms         +1010.6%  (11.1x slower)
  Memory        29.1 MiB ±     0.3 MiB     28.9 MiB …    29.4 MiB          +76.0%  (1.8x more)
 
Benchmark 1: env RAYON_NUM_THREADS=1 ./target/release/ruff format ./fixture (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     12.7 ms  ±     2.5 ms      10.9 ms  …    14.4 ms
  Memory        14.6 MiB ±     0.1 MiB     14.6 MiB …    14.7 MiB
 
Benchmark 2: black --no-cache ./fixture --workers=1 --safe (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     95.2 ms  ±     3.2 ms      92.9 ms  …    97.4 ms          +650.6%  (7.5x slower)
  Memory        38.4 MiB ±     0.0 MiB     38.4 MiB …    38.4 MiB         +162.6%  (2.6x more)
 
Benchmark 3: black --no-cache ./fixture --workers=1 --fast (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     89.6 ms  ±     2.8 ms      87.6 ms  …    91.6 ms          +606.5%  (7.1x slower)
  Memory        38.4 MiB ±     0.0 MiB     38.4 MiB …    38.4 MiB         +162.7%  (2.6x more)
 
Benchmark 4: black --no-cache ./fixture --workers=1 --safe --preview (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     94.7 ms  ±     0.6 ms      94.3 ms  …    95.2 ms          +646.9%  (7.5x slower)
  Memory        38.5 MiB ±     0.1 MiB     38.5 MiB …    38.6 MiB         +163.5%  (2.6x more)
 
Benchmark 5: black --no-cache ./fixture --workers=1 --fast --preview (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     92.7 ms  ±     0.6 ms      92.3 ms  …    93.2 ms          +631.4%  (7.3x slower)
  Memory        38.4 MiB ±     0.1 MiB     38.3 MiB …    38.4 MiB         +162.5%  (2.6x more)
 
Benchmark 6: autopep8 ./fixture --in-place --recursive --jobs=1 (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     43.5 ms  ±     3.7 ms      40.9 ms  …    46.1 ms          +242.7%  (3.4x slower)
  Memory        26.5 MiB ±     0.1 MiB     26.4 MiB …    26.6 MiB          +81.2%  (1.8x more)
 
Benchmark 7: yapf ./fixture --recursive --in-place (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     56.8 ms  ±     1.2 ms      55.9 ms  …    57.6 ms          +347.8%  (4.5x slower)
  Memory        27.3 MiB ±     0.1 MiB     27.2 MiB …    27.4 MiB          +86.5%  (1.9x more)
 
Benchmark 1: ./target/release/ruff format ./fixture --check (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     10.2 ms  ±     0.3 ms       9.9 ms  …    10.4 ms
  Memory        16.9 MiB ±     0.1 MiB     16.8 MiB …    17.0 MiB
 
Benchmark 2: black --no-cache ./fixture --check --safe (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    193.8 ms  ±     6.2 ms     189.5 ms  …   198.2 ms         +1806.9%  (19.1x slower)
  Memory        37.3 MiB ±     0.1 MiB     37.2 MiB …    37.4 MiB         +120.8%  (2.2x more)
 
Benchmark 3: black --no-cache ./fixture --check --fast (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    188.2 ms  ±     1.9 ms     186.8 ms  …   189.6 ms         +1751.4%  (18.5x slower)
  Memory        37.3 MiB ±     0.1 MiB     37.3 MiB …    37.4 MiB         +121.1%  (2.2x more)
 
Benchmark 4: black --no-cache ./fixture --check --safe --preview (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    202.1 ms  ±     6.3 ms     197.7 ms  …   206.6 ms         +1888.5%  (19.9x slower)
  Memory        37.2 MiB ±     0.0 MiB     37.2 MiB …    37.2 MiB         +120.5%  (2.2x more)
 
Benchmark 5: black --no-cache ./fixture --check --fast --preview (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    197.0 ms  ±    20.1 ms     182.8 ms  …   211.2 ms         +1837.8%  (19.4x slower)
  Memory        37.2 MiB ±     0.0 MiB     37.2 MiB …    37.2 MiB         +120.5%  (2.2x more)
 
Benchmark 6: autopep8 ./fixture --recursive --diff (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     38.5 ms  ±     0.1 ms      38.4 ms  …    38.6 ms          +278.4%  (3.8x slower)
  Memory        26.3 MiB ±     0.0 MiB     26.3 MiB …    26.4 MiB          +56.0%  (1.6x more)
 
Benchmark 7: yapf ./fixture --parallel --recursive --quiet (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    144.8 ms  ±     7.4 ms     139.6 ms  …   150.1 ms         +1324.8%  (14.2x slower)
  Memory        29.0 MiB ±     0.2 MiB     28.9 MiB …    29.1 MiB          +71.6%  (1.7x more)
```

</details>

<details>
<summary>ty_benchmark (multi-threaded, then single-threaded)</summary>

```text
jinja
-----

Benchmark 1: ty (2 runs)
                mean     ±       σ          min     …     max
  Wall Time     73.0 ms  ±     5.6 ms      69.0 ms  …    76.9 ms
  Memory       100.1 MiB ±     0.1 MiB    100.0 MiB …   100.2 MiB
 
  Warning: Ignoring non-zero exit code.
 
Benchmark 2: Pyrefly (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    118.3 ms  ±     6.0 ms     114.0 ms  …   122.5 ms           +62.1%  (1.6x slower)
  Memory       130.9 MiB ±     0.2 MiB    130.8 MiB …   131.1 MiB          +30.8%  (1.3x more)
 
  Warning: Ignoring non-zero exit code.
 
Benchmark 3: mypy (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    802.9 ms  ±     8.0 ms     797.2 ms  …   808.6 ms         +1000.2%  (11.0x slower)
  Memory       143.4 MiB ±     0.1 MiB    143.3 MiB …   143.5 MiB          +43.2%  (1.4x more)
 
  Warning: Ignoring non-zero exit code.
 
Benchmark 4: mypy (warm) (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    208.8 ms  ±     5.6 ms     204.9 ms  …   212.7 ms          +186.1%  (2.9x slower)
  Memory        51.9 MiB ±     0.2 MiB     51.8 MiB …    52.0 MiB          -48.2%  (1.9x less)
 
  Warning: Ignoring non-zero exit code.
 
Benchmark 5: Pyright (2 runs)
                mean     ±       σ          min     …     max
  Wall Time   1198.8 ms  ±    12.0 ms    1190.3 ms  …  1207.3 ms         +1542.8%  (16.4x slower)
  Memory       251.6 MiB ±     1.3 MiB    250.7 MiB …   252.5 MiB         +151.3%  (2.5x more)
 
  Warning: Ignoring non-zero exit code.

jinja
-----

Benchmark 1: ty (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    226.1 ms  ±    14.0 ms     216.2 ms  …   236.0 ms
  Memory        84.9 MiB ±     0.2 MiB     84.8 MiB …    85.0 MiB
 
  Warning: Ignoring non-zero exit code.
 
Benchmark 2: Pyrefly (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    210.4 ms  ±     6.9 ms     205.5 ms  …   215.3 ms            -7.0%
  Memory        92.3 MiB ±     0.1 MiB     92.2 MiB …    92.4 MiB           +8.8%
 
  Warning: Ignoring non-zero exit code.
 
Benchmark 3: mypy (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    896.4 ms  ±    88.8 ms     833.7 ms  …   959.2 ms          +296.4%  (4.0x slower)
  Memory       144.3 MiB ±     0.6 MiB    143.9 MiB …   144.7 MiB          +70.0%  (1.7x more)
 
  Warning: Ignoring non-zero exit code.
 
Benchmark 4: mypy (warm) (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    213.0 ms  ±     3.7 ms     210.4 ms  …   215.6 ms            -5.8%
  Memory        51.7 MiB ±     0.1 MiB     51.6 MiB …    51.8 MiB          -39.1%  (1.6x less)
 
  Warning: Ignoring non-zero exit code.
 
Benchmark 5: Pyright (2 runs)
                mean     ±       σ          min     …     max
  Wall Time    981.9 ms  ±    13.0 ms     972.6 ms  …   991.1 ms          +334.2%  (4.3x slower)
  Memory       315.4 MiB ±     5.9 MiB    311.2 MiB …   319.5 MiB         +271.6%  (3.7x more)
 
  Warning: Ignoring non-zero exit code.
```

</details>

I also tested most of the other hyperfine invocations mentioned
somewhere in this repo.
2026-10-07 13:43:40 +00:00
Charlie Marsh 598f4bdfd5 Adopt Rust 1.97 integer APIs and Cargo warning policy (#29048)
## Summary

- Use the integer bit APIs stabilized in Rust 1.97 for packed node
indices, token capacity, rule iteration, and type-variable support sets.
- Use Cargo's warning policy in our native and WASM Clippy checks,
keeping warnings fatal without changing compiler flags and invalidating
the build cache. Update the contributing guides to match.

Preserves the Rust 1.97 MSRV. The warning policy change follows
https://github.com/astral-sh/uv/pull/22122.
2026-10-01 14:01:44 -04:00
Ee Durbin c3813a501f add a workflow for preparing releases (#28486)
this is primarily useful for testing the sts token exchange in a
non-load bearing environment ahead of merging #28484
, but may be useful for maintainers :)

`automations` environment has been created and `STS_API_URL` secret set
2026-09-10 10:44:26 -04:00
zaniebotandZanie Blue 1047cc20a2 Use centralized crates.io publishing policies (#28285)
Release preparation still directs new crates to the local bootstrap
utility, which requires a crates.io owner token and tracks configured
crates in `.known-crates`. Use `astral-sh/crates-policies` as the source
of truth instead, matching
[astral-sh/uv#20449](https://github.com/astral-sh/uv/pull/20449).
`scripts/release.sh` now runs the shared workspace checker, the
contribution guide points to the central registration process, and the
duplicate setup utility and local crate list are removed.

Co-authored-by: Zanie Blue <contact@zanie.dev>
2026-09-03 11:50:54 -05:00
Brent Westbrook 0791ddddbd Add duplicate work guidance (#28229)
Summary
--

I've noticed that some issues seem to attract a lot of (likely
automated) duplicate PRs. #28102 is a
recent example that elicited four PRs in the five days it has been open.
I'm not sure if the changes
here will actually help, but I've tried to add both contributor- and
agent-facing documentation to
suggest checking for linked PRs before opening another one.

Test Plan
--

Future issues
2026-09-02 09:15:59 -04:00
William Woodruff f96c18b8ae Use cargo insta, cargo nextest, cargo codspeed from toolchain (#28210)
Signed-off-by: William Woodruff <william@yossarian.net>
2026-09-01 14:52:34 +00:00
William Woodruff da9e283158 Swap cargo shear and hyperfine to the Astral toolchain (#28197)
Signed-off-by: William Woodruff <william@yossarian.net>
2026-08-31 14:19:43 -04:00
Brent Westbrook aad0e909ef Allow rules without codes (#28049)
Summary
--

This PR allows adding rules that only belong to categories and only have
names rather than requiring
a linter group and code.

The first non-empty commit uses `Rule::name` instead of
`Rule::noqa_code` throughout the linter tests, causing a huge number of
file renames without changes.

The second commit updates `FixTable` from a mapping of `SecondaryCode ->
(name, fix_count)` to
`DiagnosticId -> (Option<SecondaryCode>, fix_count)`. This doesn't
really change its usage but
involves minor diffs to a substantial number of lines. It also allows us
to drop some of the special
`hashbrown` handling and the `hashbrown` dependency in `ruff_linter`,
which is nice.

The third commit contains the bulk of the change, including the macro
changes needed to support
`map_codes` entries like that for the `pytest-fixture-autouse` rule in
the fourth commit:

```rust
() => rules::ruff::rules::PytestFixtureAutouse,
```

These changes are pretty mechanical overall, just handling cases where
the linter or noqa code could
be missing, which fortunately seemed pretty straightforward in every
case.

The fourth commit takes advantage of these changes to reinstate `RUF076`
as our first purely
`pedantic` rule. I'm happy to drop that if it's too controversial or
opens too many questions about
the previously-removed rule and its code, but I thought it was nice to
have a motivating example. We
moved this rule from `preview` to `removed` because it was too pedantic
for the `RUF` category, even
in preview, so it's exactly the kind of rule we can support now with the
categories.

Finally, the fifth commit updates the contributing docs to reflect that
linters and codes are
optional. This may need to be adjusted if we back out the `RUF076`
change.

Test Plan
--

Existing tests, plus a few new ones for `pytest-fixture-autouse`
2026-08-27 11:26:35 -04:00
Brent WestbrookandMicha Reiser 29c8e5b2d0 Document rule acceptance guidelines (#27910)
Summary
--

This PR includes the contributor-facing documentation for the new
categories, as well as updated
rule acceptance guidelines built atop them.

I think we could also update our rule request template based on some of
these guidelines, but I'll save that for a follow-up once these are
solidified.

Test Plan
--

Future rule requests

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2026-08-27 11:26:34 -04:00
Brent Westbrook ada87950ea Introduce category selectors (#27666)
## Summary

This PR introduces clippy-style rule categories that can be used
alongside existing linter-based categories in preview. The categories
have a lower `specificity` than linter groups, meaning that `select =
UP` and `ignore = correctness` will not ignore `UP` correctness rules.
In general this leads to more rules being enabled than the alternative
we considered where categories and linter groups had equal precedence,
which makes it seem like a safer default. We can revisit this if it
proves to be unintuitive, or we can add a Cargo-style `priority` field
in the worst case.

I've tried to organize the commits such that this can be reviewed
commit-by-commit and could also be split into multiple PRs. The first
two commits update the `ViolationMetadata` macro to allow providing a
`category` argument and add such arguments for all rules. This part
could be a standalone change without exposing the categories to users
but still depends on reaching consensus on all rule categories. The
second pair of commits allows using the new categories as selectors
alongside existing selectors, including some precedence tests with other
selector types.

This mostly addresses #1774, but there are some sub-issues there to
resolve before closing the issue.

## Test Plan

New CLI tests and a new mdtest suite around rule precedence
2026-08-27 11:26:33 -04:00
konsti b169b40235 Install cargo tools locked (#27929) 2026-08-20 09:11:02 -04:00
William WoodruffandAlex Waygood 7ed8d1fbdd Manage docs build with a dep group (#27843)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Signed-off-by: William Woodruff <william@yossarian.net>
2026-08-18 20:56:20 +00:00
Shaan Majid c360a05e9a chore: run prek from a locked uv dev group (#26463)
## Summary

Add a locked `uv` workflow for running `prek` in CI and local
development.

This pins `prek` via a new `dev` PEP 735 dependency group, introduces a
committed `uv.lock` file, and updates CI to run `prek` through `uv run
--only-group dev --locked`. It also adds a frozen `uv-lock` pre-commit
hook to ensure future changes keep the lockfile in sync. Lastly, I
noticed that some pre-commit priority blocks did not match the comment
sections, so this does some opportunistic cleanup to move these around.

Atop #26461. Closes #26386.

## Test Plan

```bash
uv run --only-dev prek --all-files
```
2026-07-01 01:09:42 -07:00
Charlie Marsh dff016b7a4 Publish Ruff crates to crates.io (#26271)
## Summary

Publish Ruff's production Rust crates to crates.io as part of the
existing release workflow. This follows uv's setup: workspace
dependencies carry registry-compatible version pins, internal crates
receive generated READMEs and an explicit versioning policy, CI dry-runs
the full workspace publish, and release jobs publish missing crate
versions idempotently through crates.io trusted publishing.

The publishing set contains 32 packages: Ruff's CLI, WASM package,
server, linter, formatter, parser, and the internal Ruff component
crates required by them. It also includes `ty_module_resolver`,
`ty_site_packages`, and `ty_static`, because those three crates are part
of Ruff's normal dependency closure.

The publishing set deliberately excludes:

- Test-only crates: `mdtest`, `ruff_mdtest`,
`ruff_python_ast_integration_tests`, and
`ruff_python_trivia_integration_tests`.
- Benchmark and development crates: `ruff_benchmark` and `ruff_dev`.
- All remaining `ty_*` crates.

These packages retain `publish = false`, so bootstrap, version bumping,
README generation, CI dry-runs, and release publishing skip them through
Cargo metadata instead of a separate hard-coded allowlist.

The crates.io job is intentionally independent of release announcement,
so a crates.io outage cannot block the existing binary, PyPI, npm, or
GitHub release outputs. A bootstrap script reserves new crate names,
configures the release workflow as each crate's trusted publisher,
enables trusted-publishing-only releases, and records configured crates
for idempotent reruns.

The full workspace publish dry-run packages and verifies all 32 selected
crates.

Closes https://github.com/astral-sh/ruff/issues/43.
2026-06-23 12:49:23 -04:00
Alex Waygood 7e1bc1e75f Add agent skills for working on ty (#25422)
## Summary

This PR adds a `.agents/skills` directory to the repo, and adds three
skills to help agents work on ty more effectively:
- A skill to help them write better ty diagnostics
- A skill to help them minimize a single ecosystem change more
effectively
- A skill to help them analyze and summarise ecosystem reports more
effectively

The skills have been designed so that they will (hopefully) work well
whether a contributor is using Codex or Claude as their agent locally.
Codex should discover these skills automatically if you're working on
the repo; if you use Claude locally, you _should_ hopefully be prompted
by Claude to install the local skills due to them being listed as
recommended skills in `.claude/settings.json`.

## Test Plan

I ran `/review` locally with Codex, instructing it to be as nitpicky as
possible, until it could find no more issues with these skills.
2026-05-27 22:02:29 +01:00
Brent Westbrook baf9f1977a Update release process docs (#25297)
Summary
--

* Drops the instructions for updating the ruff-lsp repo, which has been
archived
* Removes the minor release guidance for ruff-vscode, which we are now
updating each release
2026-05-21 09:39:16 -07:00
Brent Westbrook 4bae734a78 Update Ruff mdtest structure (#25246)
Summary
--

While working on #25233, I realized that my suggestion to group multiple
rules within the same
Markdown file using top-level headings ran afoul of a markdownlint
[rule] against having multiple
top-level headings in the same file. I was a bit worried about the size
of the resulting files if we
followed this suggestion anyway, so I think the best course of action is
to recommend directories
for each linter with a separate file per rule.

This PR updates our existing mdtests to this new structure and also
updates the recommendation in the
contributing docs.

Test Plan
--

Existing mdtests in new locations

[rule]:
https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md025---multiple-top-level-headings-in-the-same-document
2026-05-20 06:15:56 -07:00
Brent WestbrookandMicha Reiser 505a51c06c Add mdtests for Ruff (#24617)
Summary
--

This PR adds the `ruff_test` crate, a parallel crate to `ty_test` for
Ruff, to
enable the new mdtests in `ruff_linter`. I opted to follow the
`Db`-based
structure of `ty_test` to simplify the integration, but we end up
basically just
unpacking the files from the `Db` to call the `test_contents` function
from the
linter.

I also updated the section of the contributing guidelines on lint rule
testing to suggest using mdtests.

Test Plan
--

I copied over the S704 tests into a new mdtest. I selected this rule
because it had several separate fixture files that all used different
settings and each of the fixtures was relatively short. I had initially
reached for a more complicated rule (UP046), but this seemed less likely
to clutter the diff while still exercising most mdtest features.

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2026-05-18 06:28:19 -07:00
Dylan b7561eda6a Document adding fixes in CONTRIBUTING.md (#24393)
Closes #1625
2026-04-03 14:42:50 +00:00
Zanie Blue 3286a62be9 Add a "release-gate" step to the release workflow (#24365)
Mirrors https://github.com/astral-sh/uv/pull/18804

You can see the environment policies I'll apply following merge at
https://github.com/astral-sh/github-policies/tree/main/environments

Also updates the Docker workflow to avoid using release secrets when not
pushing.
2026-04-02 10:01:32 -05:00
Amethyst Reese a65f29f4dc Add company AI policy to contributing guide (#24021) 2026-03-17 10:32:03 -07:00
Brent Westbrook f516d47ceb Update contributing guide for adding a new rule (#22779)
Summary
--

This is a follow-up to #21035 and #22732 to update the contribution
guide for
adding a new rule for the changes to the `violation_metadata` attribute
and also
to how we emit diagnostics.

Test Plan
--

Built and viewed the docs locally to make sure they render correctly
2026-01-21 18:24:22 +00:00
Charlie Marsh 7bacca9b62 Use prek in documentation and CI (#22505)
## Summary

AFAIK, many of us on the team are using prek now. It seems appropriate
to modify the docs to formalize it.
2026-01-11 14:17:10 -05:00
mahiro 5df8a959f5 Update mkdocs-material to 9.7.0 (Insiders now free) (#21797) 2025-12-05 08:53:08 +01:00
Brent WestbrookandMicha Reiser 8d1efe964a Add a new "Opening a PR" section to the contribution guide (#21298)
Summary
--

This PR adds a new section to CONTRIBUTING.md describing the expected
contents of the PR summary and test plan, using the ecosystem report,
and communicating the status of a PR.

This seemed like a pretty good place to insert this in the document, at
the end of the advice on preparing actual code changes, but I'm
certainly open to other suggestions about both the content and
placement.

Test Plan
--

Future PRs :)

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2025-11-10 14:12:32 +00:00
Amethyst Reese 7a347c4370 [ruff] update the release process documentation (#20752) 2025-10-07 13:18:48 -07:00
Micha Reiser 81f43a1fc8 Add the *The Basics* title back to CONTRIBUTING.md (#20624) 2025-09-29 07:46:01 +00:00
Micha ReiserandAlex Waygood 9f3cffc65c Add 'Finding ways to help' to CONTRIBUTING.md (#20567)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-09-25 12:46:41 +02:00
Cornelius RoemerandMicha Reiser b8dddd514f chore: Document Material for MkDocs Insiders limitations in CONTRIBUTING.md in more detail (#19373)
Co-authored-by: Micha Reiser <micha@reiser.io>
2025-07-16 08:42:25 +00:00
Brent Westbrook 9220addf52 Split the changelog into separate files (#18725)
Summary
--

During the release today, I noticed that the changelog is finally too
long to
render at all on GitHub. This PR follows the same splitting procedure as
in
uv (astral-sh/uv#11510, astral-sh/uv#12099): first splitting the file
into one
per minor version, and then reversing the contents of each file to start
with
the breaking release (`changelogs/0.11.x.md` starts with 0.11.0 instead
of
0.11.13 as in the old changelog).

For the second part, I used
[`reverse-changelog.py`](https://github.com/astral-sh/uv/blob/main/scripts/reverse-changelog.py)
from the uv repo, so hopefully everything is correct. I spot-checked
0.7.0 at least.
2025-06-17 13:27:36 -04:00
renovate[bot]andMicha Reiser 38c332fe23 Update Rust crate bincode to v2 (#18188)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micha Reiser <micha@reiser.io>
2025-05-19 08:57:09 +02:00
renovate[bot]andMicha Reiser a761b8cfa2 Update pre-commit dependencies (#18172)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micha Reiser <micha@reiser.io>
2025-05-19 08:28:43 +02:00
00f672a83b [ty] contribution guide (#18061)
First take on a contributing guide for `ty`. Lots of it is copied from
the existing Ruff contribution guide.

I've put this in Ruff repo, since I think a contributing guide belongs
where the code is. I also updated the Ruff contributing guide to link to
the `ty` one.

Once this is merged, we can also add a link from the `CONTRIBUTING.md`
in ty repo (which focuses on making contributions to things that are
actually in the ty repo), to this guide.

I also updated the pull request template to mention that it might be a
ty PR, and mention the `[ty]` PR title prefix.

Feel free to update/modify/merge this PR before I'm awake tomorrow.

---------

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: David Peter <mail@david-peter.de>
2025-05-13 10:55:01 +02:00
Micha Reiser d03a7069ad Add instructions on how to upgrade to a newer Rust version (#17928) 2025-05-07 20:11:58 +02:00
Alex Waygoodandeqsdxr 5cd0de3e4c Fix minor punctuation errors (#16228)
Co-authored-by: eqsdxr <rxdsqe@gmail.com>
2025-02-18 12:24:57 +00:00
Micha Reiser dcb85b7088 Update benchmark scripts, use uv (#15120) 2024-12-23 11:14:15 +01:00
renovate[bot] 5a67d3269b Update pre-commit dependencies (#14719) 2024-12-02 06:02:56 +00:00
Micha ReiserandAlex Waygood 14ba469fc0 Use a derive macro for Violations (#14557)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-11-27 09:41:40 +00:00
Zanie Blue e76f77d711 Use uv in contribution document (#13540) 2024-09-30 14:42:59 -05:00
Teodoro Freund a822fd6642 Fixed benchmarking section in Contributing guide (#13107)
## Summary

Noticed there was a wrong tip on the Contributing guide, `cargo
benchmark lexer` wouldn't run any benches.
Probably a missed update on #9535 

It may make sense to remove the `cargo benchmark` command from the guide
altogether, but up to the mantainers.
2024-08-26 18:49:01 +05:30
olp-cs 93f9023ea3 Add hyperfine installation instructions; update hyperfine code samples (#13034)
## Summary

When following the step-by-step instructions to run the benchmarks in
`CONTRIBUTING.md`, I encountered two errors:

**Error 1:**
`bash: hyperfine: command not found`
    
**Solution**: I updated the instructions to include the step of
installing the benchmark tool.

**Error 2:**
```shell
$ ./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ 
error: `ruff <path>` has been removed. Use `ruff check <path>` instead.
```
**Solution**: I added `check`.

## Test Plan

I tested it by running the benchmark-related commands in a new workspace
within GitHub Codespaces.
2024-08-22 09:05:09 +05:30
Mathieu KniewallnerandMicha Reiser f5bff82e70 docs(contributing): remove TOC (#12903)
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-08-19 09:38:08 +00:00
Alex Waygood ab44152eb5 Improve release instructions for when ruff-lsp and ruff-vscode updates are required (#12952) 2024-08-19 10:29:16 +01:00
Alex Waygood ef1f6d98a0 Fix description of where the contributor list comes from in instructions for making a release (#12931) 2024-08-16 15:37:21 +01:00
Charlie Marsh 15aa5a6d57 Detect imports in src layouts by default (#12848)
## Summary

Occasionally, we receive bug reports that imports in `src` directories
aren't correctly detected. The root of the problem is that we default to
`src = ["."]`, so users have to set `src = ["src"]` explicitly. This PR
extends the default to cover _both_ of them: `src = [".", "src"]`.

Closes https://github.com/astral-sh/ruff/issues/12454.

## Test Plan

I replicated the structure described in
https://github.com/astral-sh/ruff/issues/12453, and verified that the
imports were considered sorted, but that adding `src = ["."]` showed an
error.
2024-08-14 18:15:45 +02:00