Commit Graph
718 Commits
Author SHA1 Message Date
renovate[bot] bb8c11600c Update dependency mdformat-mkdocs to v5.2.0 (#26618) 2026-07-07 20:44:41 -04:00
Brent Westbrook 63b82b0676 Add --add-ignore for adding ruff:ignore comments (#26346)
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.
2026-07-07 12:26:38 -04:00
renovate[bot] c8745834d3 Update dependency ruff to v0.15.20 (#26485) 2026-06-30 20:45:10 -04:00
ErikandMicha Reiser fa4a7bca2d ruff: Add --extend-exclude to ruff format (#26372)
Co-authored-by: Micha Reiser <micha@reiser.io>
2026-06-27 14:03:17 +00:00
Brent Westbrook f82a36b6ba Bump 0.15.20 (#26376) 2026-06-25 10:00:55 -07:00
Brent Westbrook f703f219d7 Allow human-readable names in rule selectors (#25887)
## 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.
2026-06-25 08:34:26 -07:00
renovate[bot] 7527c251ab Update dependency ruff to v0.15.19 (#26294) 2026-06-24 01:42:58 +00:00
Charlie Marsh 7f0436561d Bump version to 0.15.19 (#26291) 2026-06-23 20:42:26 -04: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
sanjibani 62ceb4e6b4 docs(editors/features): fix dead ruff preview/preview.md link (#26210) 2026-06-22 08:51:25 +00:00
sanjibani 694334c51c docs(installation): fix dead alpinelinux testing repo link (#26209) 2026-06-22 08:41:12 +00:00
Brent Westbrook 6686f63404 Bump 0.15.18 (#26135) 2026-06-18 11:07:24 -07:00
renovate[bot] b21812bca3 Update dependency ruff to v0.15.17 (#26061) 2026-06-16 20:49:30 -04:00
Brent Westbrook 7c645a9a1b Bump 0.15.17 (#25872) 2026-06-11 10:08:53 -07:00
Brent Westbrook 53f6ff7200 Allow human-readable names in suppression comments (#25614)
## 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
2026-06-11 07:24:17 -07:00
renovate[bot] 8828ba9fd5 Update dependency ruff to v0.15.16 (#25795) 2026-06-09 21:22:53 -07:00
Brent Westbrook 6c498ab539 Bump 0.15.16 (#25635) 2026-06-04 09:15:41 -07:00
renovate[bot] 39a6434452 Update dependency ruff to v0.15.15 (#25568) 2026-06-02 22:20:00 -04:00
JohnKagundaandBrent Westbrook 7ef96bec9a [pydocstyle] Improve discoverability of rules enabled for each convention (#24973)
## 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>
2026-06-01 14:36:36 +00:00
Tejas AmleandClaude 042a6a1729 docs: fix typo bin/active → bin/activate in tutorial (#25473)
## 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>
2026-05-30 09:57:12 +02:00
Brent Westbrook db5aa0a5f1 Bump 0.15.15 (#25431) 2026-05-28 06:54:03 -07:00
renovate[bot] 6aaa91ac2b Update dependency ruff to v0.15.14 (#25402) 2026-05-27 07:29:07 +01:00
Micha Reiser 305808d9ad Update configuration.md (#25396) 2026-05-26 15:58:14 +01:00
Martin SchlossarekandMartin Schlossarek f2fb134161 Fix line-length example for --config option (#25389)
Co-authored-by: Martin Schlossarek <martin@schlossarek.me>
2026-05-26 13:38:36 +00:00
Brent Westbrook 9ad2da3015 Bump 0.15.14 (#25295) 2026-05-21 07:17:42 -07:00
OscarandOscar Caballero 9999a3967a Update code example on how to update Neovim LSP log level (#25284)
## Summary

Update deprecated neovim syntax in the editor setup docs.

`vim.lsp.set_log_level` is deprecated as of neovim 0.12. [See neovim
docs](https://neovim.io/doc/user/deprecated/#deprecated-0.12)

## Test Plan

Docs only changes. Tested locally using `mkdocs`.

Co-authored-by: Oscar Caballero <oscar.caballero@veeva.com>
2026-05-21 15:22:34 +05:30
renovate[bot] 91ea0357a2 Update dependency ruff to v0.15.13 (#25256)
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [ruff](https://docs.astral.sh/ruff)
([source](https://redirect.github.com/astral-sh/ruff),
[changelog](https://redirect.github.com/astral-sh/ruff/blob/main/CHANGELOG.md))
| `==0.15.12` → `==0.15.13` |
![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.15.13?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.15.12/0.15.13?slim=true)
|

---

### Release Notes

<details>
<summary>astral-sh/ruff (ruff)</summary>

###
[`v0.15.13`](https://redirect.github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#01513)

[Compare
Source](https://redirect.github.com/astral-sh/ruff/compare/0.15.12...0.15.13)

Released on 2026-05-14.

##### Preview features

- Add a rule to flag lazy imports that are eagerly evaluated
([#&#8203;25016](https://redirect.github.com/astral-sh/ruff/pull/25016))
- \[`pylint`] Standardize diagnostic message (`PLR0914`, `PLR0917`)
([#&#8203;24996](https://redirect.github.com/astral-sh/ruff/pull/24996))

##### Bug fixes

- Fix `F811` false positive for class methods
([#&#8203;24933](https://redirect.github.com/astral-sh/ruff/pull/24933))
- Fix setting selection for multi-folder workspace
([#&#8203;24819](https://redirect.github.com/astral-sh/ruff/pull/24819))
- \[`eradicate`] Fix false positive for lines with leading whitespace
(`ERA001`)
([#&#8203;25122](https://redirect.github.com/astral-sh/ruff/pull/25122))
- \[`flake8-pyi`] Fix false positive for f-string debug specifier
(`PYI016`)
([#&#8203;24098](https://redirect.github.com/astral-sh/ruff/pull/24098))

##### Rule changes

- Always include panic payload in panic diagnostic message
([#&#8203;24873](https://redirect.github.com/astral-sh/ruff/pull/24873))
- Restrict `PYI034` for in-place operations to enclosing class
([#&#8203;24511](https://redirect.github.com/astral-sh/ruff/pull/24511))
- Improve error message for parameters that are declared `global`
([#&#8203;24902](https://redirect.github.com/astral-sh/ruff/pull/24902))
- Update known stdlib
([#&#8203;25103](https://redirect.github.com/astral-sh/ruff/pull/25103))

##### Performance

- \[`isort`] Avoid constructing `glob::Pattern`s for literal known
modules
([#&#8203;25123](https://redirect.github.com/astral-sh/ruff/pull/25123))

##### CLI

- Add TOML examples to `--config` help text
([#&#8203;25013](https://redirect.github.com/astral-sh/ruff/pull/25013))
- Colorize ruff check 'All checks passed'
([#&#8203;25085](https://redirect.github.com/astral-sh/ruff/pull/25085))

##### Configuration

- Increase max allowed value of `line-length` setting
([#&#8203;24962](https://redirect.github.com/astral-sh/ruff/pull/24962))

##### Documentation

- Add `D203` to rules that conflict with the formatter
([#&#8203;25044](https://redirect.github.com/astral-sh/ruff/pull/25044))
- Clarify `COM819` and formatter interaction
([#&#8203;25045](https://redirect.github.com/astral-sh/ruff/pull/25045))
- Clarify that `NotImplemented` is a value, not an exception (`F901`)
([#&#8203;25054](https://redirect.github.com/astral-sh/ruff/pull/25054))
- Update number of lint rules supported
([#&#8203;24942](https://redirect.github.com/astral-sh/ruff/pull/24942))

##### Other changes

- Simplify the playground's markdown template
([#&#8203;24924](https://redirect.github.com/astral-sh/ruff/pull/24924))

##### Contributors

- [@&#8203;MichaReiser](https://redirect.github.com/MichaReiser)
- [@&#8203;brian-c11](https://redirect.github.com/brian-c11)
- [@&#8203;Andrej730](https://redirect.github.com/Andrej730)
- [@&#8203;denyszhak](https://redirect.github.com/denyszhak)
- [@&#8203;darestack](https://redirect.github.com/darestack)
- [@&#8203;sharkdp](https://redirect.github.com/sharkdp)
- [@&#8203;charliermarsh](https://redirect.github.com/charliermarsh)
- [@&#8203;EkriirkE](https://redirect.github.com/EkriirkE)
- [@&#8203;eyupcanakman](https://redirect.github.com/eyupcanakman)
- [@&#8203;Hrk84ya](https://redirect.github.com/Hrk84ya)
- [@&#8203;thernstig](https://redirect.github.com/thernstig)
- [@&#8203;ntBre](https://redirect.github.com/ntBre)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - "before 4am on Wednesday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODUuMSIsInVwZGF0ZWRJblZlciI6IjQzLjE4NS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-05-20 11:21:00 +05:30
Brent Westbrook 2afb467ce3 Bump 0.15.13 (#25157) 2026-05-14 13:18:49 +00:00
Adeleke Dare 85705f10d8 Add TOML examples to --config help text (#25013)
This PR adds TOML examples to the `--config` help text to clarify that
it accepts both file paths and inline key-value pairs.
2026-05-12 06:24:18 -07:00
Andrej730 89b45a9917 Add D203 to rules that conflict with the formatter (#25044)
Noticed the warning below when running `ruff format`, which wasn't
documented in
https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules.

```
ruff format --check
# warning: The following rule may cause conflicts when used with the formatter: `D203`. 
# To avoid unexpected behavior, we recommend disabling this rule, either by removing it from the `lint.select` or `lint.extend-select` configuration, or adding it to the `lint.ignore` configuration.
```
2026-05-11 13:41:21 -07:00
Tobias Hernstig bbc529bc8a docs: Use correct number of lint rules supported (#24942) 2026-04-30 09:08:53 +00:00
renovate[bot] a7d824529b Update dependency ruff to v0.15.12 (#24857) 2026-04-26 22:22:41 -04:00
Dylan 66f93cf7ed Bump 0.15.12 (#24815) 2026-04-24 12:36:40 -05:00
Amethyst Reese ed669eab30 Implement #ruff:file-ignore file-level suppressions (#23599)
Follow-up to #23404

Add support for `#ruff:file-ignore[code]` style file-level suppressions
as own-line comments at global module scope. The range covered by these
suppressions is always the entirety of the file:

```py
# ruff:file-ignore[ARG001]

def foo(
	arg1,
	arg2,
):
	pass

def bar(
	arg1,
	arg2,
):
	pass
```

This currently requires having preview mode enabled. Without preview
mode,
the comments are parsed and processed, but not materialized into active
suppressions at runtime.
2026-04-24 16:02:15 +00:00
Auguste Lalande ae5e5b9ba9 [docs] Improve rules table accessibility (#24711) 2026-04-21 14:27:23 +01:00
Amethyst Reese 49aa2b253d Implement #ruff:ignore logical-line suppressions (#23404)
Adds support for `#ruff:ignore[code]` style suppressions as either
own-line
or end-of-line comments. The range covered by these suppressions is
determined
by the comment's position relative to the associated logical line
(statement
or suite header).

Standalone `ignore` comments apply to an entire multi-line
statement/header if the comment appears above the first line:
```py
# covers the entire header
def foo(
	arg1,
	arg2,
):
	pass
```
But will only apply to a single following line if it appears in the
middle of a multi-line statement/header:
```py
def foo(
	# only covers the next line
	arg1,
	arg2,
):
	pass
```

Trailing comments will only apply to a single physical line, similar to
existing `#noqa` comments:

```py
def foo(
    arg1, # only covers arg1
    arg2,
):
    pass
```


Intervening comments are allowed, which enables "stacking" of
`#ruff:ignore` comments with other own-line pragma comments:
```py
# ruff:ignore[code]
# fmt:off
value = [
	1, 2,
	3, 4,
]
# fmt:on
```

Includes some refactoring of the structs to generalize the naming/terms
used, otherwise the rest of the suppression system should be able to
stay unchanged.
2026-04-20 11:38:32 -07:00
renovate[bot] fd8e921461 Update dependency ruff to v0.15.11 (#24723)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-19 22:11:12 -04:00
Amethyst Reese 53554b1cfe Bump 0.15.11 (#24678) 2026-04-16 11:17:46 -07:00
Ben Berry-AllwoodandDhruv Manilawala 8d0cdb32dd Update Neovim config examples to use vim.lsp.config (#24577)
## Summary

Neovim 0.11 (in March 2025) added
[vim.lsp.config()](https://neovim.io/doc/user/lsp/#vim.lsp.config())
which is now the recommended way to set up language servers. This was
added to the Ruff docs in #18108 in addition to the legacy method using
`nvim-lspconfig`.

Calling `nvim-lspconfig` to configure a language server is deprecated -
see [their
documentation](https://github.com/neovim/nvim-lspconfig?tab=readme-ov-file#important-%EF%B8%8F).

This PR:
- updates the documentation which describes both methods to now prefer
`vim.lsp.config`
- updates all other examples which only show the legacy method to now
use `vim.lsp.config`.

## Test Plan

I have tested a subset of the examples locally using Neovim 0.12.1.

---

I considered just removing the legacy method but was unsure. I'll follow
others' guidance on when that should be kept until.


https://github.com/user-attachments/assets/93984c45-a2f1-48dd-9fec-ed291b0a144e

---------

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2026-04-13 07:44:45 +00:00
renovate[bot] e0c94198f0 Update dependency ruff to v0.15.10 (#24587)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-13 08:42:10 +02:00
Brent Westbrook 252f76102a Bump 0.15.10 (#24519) 2026-04-09 09:48:41 -04:00
shizuku 16c4090d0a docs: fix JSON typo in settings example (#24517)
## Summary

Fix a typo in the `fixViolation` example in `docs/editors/settings.md`
by removing a stray `=`.

## Test Plan

- not applicable (documentation-only change)
2026-04-09 11:27:19 +00:00
renovate[bot] 6ce1905aed Update dependency ruff to v0.15.9 (#24431) 2026-04-05 22:05:31 -04:00
renovate[bot] 2703ec64fd Update dependency mkdocs-redirects to v1.2.3 (#24430) 2026-04-05 22:05:23 -04:00
Dylan 724ccc1ae8 Bump 0.15.9 (#24369) 2026-04-02 12:59:00 -05:00
Matthew Lloyd 6468a35e9b Add nested-string-quote-style formatting option (#24312) 2026-03-31 18:48:24 +02:00
renovate[bot] fe84a4e987 Update dependency mkdocs-material to v9.7.6 (#24285) 2026-03-29 20:30:34 -04:00
renovate[bot] d11fd4bacb Update dependency ruff to v0.15.8 (#24286) 2026-03-29 20:29:32 -04:00
Amethyst Reese c2a8815842 Release 0.15.8 (#24217)
- **changelog**
- **everything else**
2026-03-26 11:20:09 -07:00
renovate[bot] 926036071f Update dependency mkdocs-material to v9.7.5 (#24118) 2026-03-22 20:28:39 -04:00