Files
Brent Westbrook 947179d7c6 Enable lint.preview and missing default rules in our Ruff config (#28112)
Summary
--

This PR updates our ruff-pre-commit dependency to 0.16.5, which supports
the new category selectors,
and then enables `lint.preview` and the new default categories so that
we can dogfood them on our
code. There were 66 diagnostics initially, which I also fixed or
ignored:

```
28	FURB113 	[ ] repeated-append
12	ASYNC240	[ ] blocking-path-method-in-async-function
 6	RUF105  	[*] noqa-comments
 5	PLW1510 	[ ] subprocess-run-without-check
 3	PLW0108 	[ ] unnecessary-lambda
 2	EXE001  	[ ] shebang-not-executable
 2	RUF039  	[*] unraw-re-pattern
 1	B024    	[ ] abstract-base-class-without-abstract-method
 1	FURB142 	[*] for-loop-set-mutations
 1	PERF102 	[ ] incorrect-dict-iterator
 1	PLC0207 	[*] missing-maxsplit-arg
 1	PLW0127 	[ ] self-assigning-variable
 1	TRY004  	[ ] type-check-without-type-error
 1	PLW0120 	[*] useless-else-on-loop
 1	TRY201  	[ ] verbose-raise
 ```

Of these, I ignored `repeated-append` and `blocking-path-method-in-async-function`. I think they are
still reasonable defaults, just less useful/important in our uses.

0.16.5 also includes https://github.com/astral-sh/ruff-pre-commit/pull/159, so I removed `markdown` from our main `ruff-format` hook, leaving it for the later mdtest formatting stage.

I also had to make a few changes related to config discovery in tests:
- move our cached ecosystem checkouts to `$RUNNER_TEMP` instead of inside of our checkout
- convert some CLI tests to use the `CliTest` helpers
- add `configurationPreference: editorOnly` to some notebook tests

In these cases, our own Ruff settings were being inherited by test code. This likely affects many other tests, but I only updated the obviously failing ones for now. I'm least confident about the notebook tests, but as far as I can tell from the history (https://github.com/astral-sh/ruff/pull/11944, https://github.com/astral-sh/ruff/pull/22810), the specific diagnostics are not the important parts being asserted.

Test Plan
--

CI on this PR
2026-08-28 12:24:36 -04:00

31 lines
749 B
TOML

[build-system]
requires = ["uv_build>=0.12.3,<0.13"]
build-backend = "uv_build"
[project]
name = "ruff-ecosystem"
version = "0.0.0"
requires-python = ">=3.11"
dependencies = ["unidiff==1.0.0", "tomli_w==1.2.0", "tomli==2.4.1"]
[project.scripts]
ruff-ecosystem = "ruff_ecosystem.cli:entrypoint"
[tool.ruff.lint]
ignore = [
# We're not worried enough about briefly blocking the event loop to add more dependencies.
"blocking-path-method-in-async-function",
"debugger",
"repeated-append",
]
preview = true
[tool.uv]
no-build = true
no-binary-package = ["ruff-ecosystem"]
# Pin the isolated build environment for source-build exceptions.
build-constraint-dependencies = ["uv-build==0.12.3"]
[tool.uv.build-backend]
module-root = ""