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>
Summary
--
This includes the user-facing updates to our linter docs and selection
settings to accompany #27666.
Test Plan
--
A few existing snapshot updates but mostly users reading this
---------
Co-authored-by: Micha Reiser <micha@reiser.io>
## Summary
Add a section on `pycon` handling to the *Markdown code formatting*
section.
Fixes#27151
## Test Plan
- verified markdown output locally
- run `scripts/check_docs_formatted.py --generate-docs`
- run `mkdocs build --strict`
- run `mkdocs serve` and inspect the site preview
---------
Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
Summary
--
This makes sense to accompany `ruff: ignore` comments being stabilized.
The preview gate has been pushed down to cover only the names vs codes
decision. I'll flag this as a comment, but I wasn't totally sure about
the LSP case. I left using `ruff: ignore` in its suppression edits
preview-gated for now.
Test Plan
--
Existing tests, dropping one that showed the preview error with
`--add-ignore`. I left `--preview` in many of the tests to continue
testing the human-readable names but removed it from one.
This PR stabilizes the expanded default rule set currently in preview
and adds a new generated `Default Rules` page to the docs to avoid
needing to include a lengthy selector block in multiple places.
Summary
--
This PR stabilizes the Markdown formatting initially added in #22470. It
also reverts much of the
error plumbing in the LSP that was added in #24150. I considered keeping
the
`FormatResult::PreviewOnly` variant but went ahead and dropped it since
it was unused.
Closes#26866.
Test Plan
--
Updated existing snapshots, dropping `--preview` in some cases
Closes#21894 by adding a section about argfile support (using `@`) to
the configuration documentation.
---------
Co-authored-by: Mahadev Annabhimoju <219508079+Joosboy@users.noreply.github.com>
Summary
--
This PR adds the new `--add-ignore` flag. In preview, this adds
`ruff:ignore` comments with human-readable names instead of `noqa`
comments with codes. Without preview enabled, using the flag emits an
error. `--add-noqa` itself is still available in both preview and stable
mode.
In cases where an existing `noqa` or `ruff:ignore` comment is present, I
opted to preserve the
existing comment and to append the new comment. So something like this:
```py
import math # noqa: RUF100
```
becomes:
```py
import math # noqa: RUF100 # ruff:ignore[unused-import]
```
instead of also converting the existing `noqa` comment. I think we can
defer to one of our planned
lint rules for the conversion (and joining) instead.
As also shown in this example, the flag adds human-readable names rather
than rule codes and prefers
the same placement as a `noqa` comment, at the end of the line. The one
exception to this is an
existing `ruff:ignore` comment on its own line. In that case, we will
reuse and extend the existing
comment instead of adding an additional trailing comment, which I think
is a pretty nice balance.
Test Plan
--
Many new tests exercising the various cases Codex and I could come up
with. As the server test
shows, this actually applies to the LSP as well, where the `Disable for
this line` action now also
inserts a `ruff:ignore` comment with a rule name instead of a `noqa`
comment.
Ecosystem check
--
I also ran some tests against ecosystem projects as described in my
[comment](https://github.com/astral-sh/ruff/pull/26346#issuecomment-4801988686)
below. These revealed some additional discrepancies between
`ruff:ignore` and `noqa` (and some bugs in `noqa`/`--add-noqa` itself),
but I think it makes sense to leave these as follow-ups. I've already
opened (rough) drafts of them in:
- https://github.com/astral-sh/ruff/pull/26373
- https://github.com/astral-sh/ruff/pull/26409
- https://github.com/astral-sh/ruff/pull/26412
We could land the shebang fixes separately, but the other two are
stacked on this PR. With all three of these applied, the ecosystem check
showed parity with `--add-noqa`.
This also seems like an interesting check to add to our ecosystem
analysis in general.
## Summary
This PR enables using rule names as selectors in preview by also
attempting to parse a selector as a human-readable name in
`UnresolvedRuleSelector::resolve`. If this succeeds and preview is
enabled, the rule is activated, and if preview is disabled you get a
custom error message.
## Test Plan
A few new CLI tests. I figured the tests from
https://github.com/astral-sh/ruff/pull/26113 cover the shared behavior
for the other selectors well enough and just focused on `select` as an
example for both the CLI and config file.
## 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.
## Summary
I decided to start trying to break up
https://github.com/astral-sh/ruff/pull/23701, and this looked like the
easiest first piece. This PR allows using human-readable rule names in
the new `ruff:ignore` and similar suppression comments, in preview.
Rule names are still disallowed in `noqa` comments, and rule codes are
still allowed in `ruff:ignore` comments.
I also updated the suppression comment docs to prioritize human-readable
names for `ruff:ignore` and `ruff:file-ignore`, which are themselves
still in preview, and added a note about names also being supported for
the stable range suppression comments.
<hr>
I did notice one surprising property here in that a `noqa` comment with
a rule name does not emit [invalid-rule-code
(RUF102)](https://docs.astral.sh/ruff/rules/invalid-rule-code/#invalid-rule-code-ruf102),
even on main. This seems to be an artifact of our `noqa` parsing:
https://github.com/astral-sh/ruff/blob/f1d2b65af2529175c9a423ce83d57a6beaaa4c44/crates/ruff_linter/src/noqa.rs#L555-L562
that we may also want to consider updating now.
## Test Plan
New mdtests
## Summary
Improves discoverability of `pydocstyle` convention-based rule filtering
by moving the authoritative documentation from the FAQ into the
`lint.pydocstyle.convention` settings reference, per #15217.
Closes#15217.
## Test Plan
Documentation-only change no functional code modifications.
Verification steps:
1. Ran `cargo dev generate-docs` to regenerate `docs/settings.md` and
`ruff.schema.json` from updated docstrings
2. Ran `cargo fmt --all` to ensure Rust formatting compliance
3. Ran `cargo clippy --workspace --all-targets --all-features -- -D
warnings` - no new warnings
4. Served docs locally with `uvx --with-requirements
docs/requirements.txt -- mkdocs serve -f mkdocs.yml` and verified:
- The `lint.pydocstyle.convention` section renders with the new content
- The FAQ back-reference links to the settings section as intended
## Screenshots
### `/ruff/settings/#lint.pydocstyle`
<img width="1920" height="957" alt="image"
src="https://github.com/user-attachments/assets/d35e94a0-0968-43fb-bfe5-dd2821655716"
/>
### `/ruff/faq/#does-ruff-support-numpy-or-google-style-docstrings`
<img width="1920" height="952" alt="image"
src="https://github.com/user-attachments/assets/b8904757-f7c9-43c7-ac20-e0fbdb713acd"
/>
---------
Signed-off-by: RafaelJohn9 <rafaeljohb@gmail.com>
Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
## Summary
Fixes a one-character typo in (line 61).
The Linux/macOS virtual environment activation command was written as:
```
source .venv/bin/active
```
but should be:
```
source .venv/bin/activate
```
The Windows command on the same line () was already correct, making the
discrepancy easy to spot.
## How verified
The fix was verified by reading the file directly — is not a valid shell
script; the correct file installed by Python’s `venv` module is always .
Co-authored-by: Claude <noreply@anthropic.com>