Commit graph

10144 commits

Author SHA1 Message Date
Matthew Mckee
24707777af
[red-knot] Emit error if int/float/complex/bytes/boolean literals appear in type expressions outside typing.Literal[] (#16765)
## Summary
Fixes https://github.com/astral-sh/ruff/issues/16532

## Test Plan

New mdtest assertions added

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-03-17 11:56:16 +00:00
Micha Reiser
93ca4a96e0
[ci] Use git diff instead of changed-files GH action (#16796)
## Summary

Use bash and `git diff` to determine which steps need to run. 

We previously used the `changed-files` github actions but using `git`
directly seems simple enough.

All credit for the bash magic goes to @zanieb and @geofft. All I did was
replace the paths arguments.


## Test Plan

* [Linter only change](https://github.com/astral-sh/ruff/pull/16800):
See how the fuzzer and formatter steps, and the linter ecosystem checks
are skipped
* [Formatter only change](https://github.com/astral-sh/ruff/pull/16799):
See how the fuzzer and linter ecosystem checks are skipped
2025-03-17 12:40:34 +01:00
Alex Waygood
38bfda94ce
[syntax-errors] Improve error message and range for pre-PEP-614 decorator syntax errors (#16581)
## Summary

A small followup to https://github.com/astral-sh/ruff/pull/16386. We now
tell the user exactly what it was about their decorator that constituted
invalid syntax on Python <3.9, and the range now highlights the specific
sub-expression that is invalid rather than highlighting the whole
decorator

## Test Plan

Inline snapshots are updated, and new ones are added.
2025-03-17 11:17:27 +00:00
Mauro Fontana
4da6936ec4
[flake8-bandit] Allow raw strings in suspicious-mark-safe-usage (S308) #16702 (#16770)
## Summary
Stop flagging each invocation of `django.utils.safestring.mark_safe`
(also available at, `django.utils.html.mark_safe`) as an error.

Instead, allow string literals as valid uses for `mark_safe`.

Also, update the documentation, pointing at
`django.utils.html.format_html` for dynamic content generation use
cases.

Closes #16702 

## Test Plan
I verified several possible uses, but string literals, are still
flagged.

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2025-03-17 11:29:07 +01:00
Dylan
238ec39c56
[refurb] Avoid panicking unwrap in verbose-decimal-constructor (FURB157) (#16777) 2025-03-17 05:09:07 -05:00
Micha Reiser
b04103fa1d
[red-knot] Add --color CLI option (#16758)
## Summary

This PR adds a new `--color` CLI option that controls whether the output
should be colorized or not.

This is implements part of
https://github.com/astral-sh/ruff/issues/16727 except that it doesn't
implement the persistent configuration support as initially proposed in
the CLI document. I realized, that having this as a persistent
configuration is somewhat awkward because we may end up writing tracing
logs **before** we loaded and resolved the settings. Arguably, it's
probably fine to color the output up to that point, but it feels like a
somewhat broken experience. That's why I decided not to add the
persistent configuration option for now.


## Test Plan

I tested this change manually by running Red Knot with `--color=always`,
`--color=never`, and `--color=auto` (or no argument) and verified that:

* The diagnostics are or aren't colored
* The tracing output is or isn't colored.

---------

Co-authored-by: David Peter <sharkdp@users.noreply.github.com>
2025-03-17 10:06:34 +00:00
Micha Reiser
c100d519e9
[internal]: Upgrade salsa (#16794)
## Summary

Another salsa upgrade. 

The main motivation is to stay on a recent salsa version because there
are still a lot of breaking changes happening.
The most significant changes in this update:

* Salsa no longer derives `Debug` by default. It now requires
`interned(debug)` (or similar)
* This version ships the foundation for garbage collecting interned
values. However, this comes at the cost that queries now track which
interned values they created (or read). The micro benchmarks in the
salsa repo showed a significant perf regression. Will see if this also
visible in our benchmarks.

## Test Plan

`cargo test`
2025-03-17 11:05:54 +01:00
renovate[bot]
dbdb46dcd2
Pin dependencies (#16791)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [CodSpeedHQ/action](https://redirect.github.com/CodSpeedHQ/action) |
action | pinDigest | -> `0010eb0` |
| [PyO3/maturin-action](https://redirect.github.com/PyO3/maturin-action)
| action | pinDigest | -> `36db840` |
|
[SebRollen/toml-action](https://redirect.github.com/SebRollen/toml-action)
| action | pinDigest | -> `b1b3628` |
| [Swatinem/rust-cache](https://redirect.github.com/Swatinem/rust-cache)
| action | pinDigest | -> `f0deed1` |
| [actions/cache](https://redirect.github.com/actions/cache) | action |
pinDigest | -> `d4323d4` |
| [actions/checkout](https://redirect.github.com/actions/checkout) |
action | pinDigest | -> `11bd719` |
|
[actions/download-artifact](https://redirect.github.com/actions/download-artifact)
| action | pinDigest | -> `cc20338` |
|
[actions/github-script](https://redirect.github.com/actions/github-script)
| action | pinDigest | -> `60a0d83` |
| [actions/setup-node](https://redirect.github.com/actions/setup-node) |
action | pinDigest | -> `cdca736` |
|
[actions/setup-python](https://redirect.github.com/actions/setup-python)
| action | pinDigest | -> `4237552` |
|
[actions/upload-artifact](https://redirect.github.com/actions/upload-artifact)
| action | pinDigest | -> `4cec3d8` |
| [astral-sh/setup-uv](https://redirect.github.com/astral-sh/setup-uv) |
action | pinDigest | -> `f94ec6b` |
|
[dawidd6/action-download-artifact](https://redirect.github.com/dawidd6/action-download-artifact)
| action | pinDigest | -> `20319c5` |
|
[docker/build-push-action](https://redirect.github.com/docker/build-push-action)
| action | pinDigest | -> `471d1dc` |
| [docker/login-action](https://redirect.github.com/docker/login-action)
| action | pinDigest | -> `74a5d14` |
|
[docker/metadata-action](https://redirect.github.com/docker/metadata-action)
| action | pinDigest | -> `902fa8e` |
|
[docker/setup-buildx-action](https://redirect.github.com/docker/setup-buildx-action)
| action | pinDigest | -> `b5ca514` |
|
[extractions/setup-just](https://redirect.github.com/extractions/setup-just)
| action | pinDigest | -> `dd310ad` |
|
[jetli/wasm-bindgen-action](https://redirect.github.com/jetli/wasm-bindgen-action)
| action | pinDigest | -> `20b33e2` |
|
[jetli/wasm-pack-action](https://redirect.github.com/jetli/wasm-pack-action)
| action | pinDigest | -> `0d096b0` |
|
[peter-evans/create-or-update-comment](https://redirect.github.com/peter-evans/create-or-update-comment)
| action | pinDigest | -> `71345be` |
|
[peter-evans/find-comment](https://redirect.github.com/peter-evans/find-comment)
| action | pinDigest | -> `3eae4d3` |
|
[taiki-e/install-action](https://redirect.github.com/taiki-e/install-action)
| action | pinDigest | -> `2c41309` |
|
[uraimo/run-on-arch-action](https://redirect.github.com/uraimo/run-on-arch-action)
| action | pinDigest | -> `ac33288` |
|
[webfactory/ssh-agent](https://redirect.github.com/webfactory/ssh-agent)
| action | pinDigest | -> `dc588b6` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 09:44:48 +01:00
Micha Reiser
2a6d43740c
[internal]: Update indirect dependencies (#16792)
## Summary

```
❯ cargo update
    Updating crates.io index
    Updating git repository `https://github.com/salsa-rs/salsa.git`
    Updating git repository `https://github.com/astral-sh/lsp-types.git`
     Locking 51 packages to latest compatible versions
    Updating annotate-snippets v0.6.1 -> v0.11.5
    Updating cc v1.2.11 -> v1.2.16
    Removing chic v1.2.2
    Updating clap_complete v4.5.44 -> v4.5.46
    Updating console v0.15.10 -> v0.15.11
    Updating dyn-clone v1.0.18 -> v1.0.19
    Updating either v1.13.0 -> v1.15.0
    Updating equivalent v1.0.1 -> v1.0.2
    Updating flate2 v1.0.35 -> v1.1.0
    Updating foldhash v0.1.4 -> v0.1.5
    Updating half v2.4.1 -> v2.5.0
    Updating hermit-abi v0.4.0 -> v0.5.0
    Updating home v0.5.9 -> v0.5.11
    Updating is-terminal v0.4.15 -> v0.4.16
    Updating itoa v1.0.14 -> v1.0.15
    Updating libcst v1.6.0 -> v1.7.0
    Updating libcst_derive v1.6.0 -> v1.7.0
      Adding linux-raw-sys v0.9.3
    Updating litemap v0.7.4 -> v0.7.5
    Updating miniz_oxide v0.8.3 -> v0.8.5
    Updating once_cell v1.20.2 -> v1.21.1
    Updating oorandom v11.1.4 -> v11.1.5
    Updating os_str_bytes v7.0.0 -> v7.1.0
    Updating peg v0.8.4 -> v0.8.5
    Updating peg-macros v0.8.4 -> v0.8.5
    Updating peg-runtime v0.8.3 -> v0.8.5
    Updating pin-project v1.1.9 -> v1.1.10
    Updating pin-project-internal v1.1.9 -> v1.1.10
    Updating pkg-config v0.3.31 -> v0.3.32
    Updating portable-atomic v1.10.0 -> v1.11.0
    Updating ppv-lite86 v0.2.20 -> v0.2.21
    Updating rand_core v0.9.0 -> v0.9.3
    Updating redox_syscall v0.5.8 -> v0.5.10
      Adding rustix v1.0.2
    Updating rustversion v1.0.19 -> v1.0.20
    Updating ryu v1.0.19 -> v1.0.20
    Updating serde_repr v0.1.19 -> v0.1.20
    Updating tempfile v3.17.1 -> v3.19.0
    Updating terminal_size v0.4.1 -> v0.4.2
    Updating tinyvec v1.8.1 -> v1.9.0
    Updating toml_edit v0.22.23 -> v0.22.24
    Updating typenum v1.17.0 -> v1.18.0
    Updating uuid v1.13.1 -> v1.16.0
    Updating uuid-macro-internal v1.13.1 -> v1.16.0
    Updating wait-timeout v0.2.0 -> v0.2.1
    Updating which v7.0.1 -> v7.0.2
    Updating winnow v0.7.0 -> v0.7.4
    Removing zerocopy v0.7.35
    Removing zerocopy v0.8.14
      Adding zerocopy v0.8.23
    Removing zerocopy-derive v0.7.35
    Removing zerocopy-derive v0.8.14
      Adding zerocopy-derive v0.8.23
    Updating zerofrom v0.1.5 -> v0.1.6
    Updating zerofrom-derive v0.1.5 -> v0.1.6
    Updating zstd-sys v2.0.13+zstd.1.5.6 -> v2.0.14+zstd.1.5.7

```
2025-03-17 09:33:49 +01:00
Micha Reiser
6f5a68608e
[ci]: Fixup codspeed upgrade (#16790)
## Summary

Benchmark isn't a required build step. That's why
https://github.com/astral-sh/ruff/pull/16784/ got merged with the step
failing.

This PR fixes up the benchmarking step
2025-03-17 09:14:22 +01:00
renovate[bot]
c61d9c6bb7
Update Rust crate compact_str to 0.9.0 (#16785)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [compact_str](https://redirect.github.com/ParkMyCar/compact_str) |
workspace.dependencies | minor | `0.8.0` -> `0.9.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>ParkMyCar/compact_str (compact_str)</summary>

###
[`v0.9.0`](https://redirect.github.com/ParkMyCar/compact_str/blob/HEAD/CHANGELOG.md#090)

[Compare
Source](https://redirect.github.com/ParkMyCar/compact_str/compare/v0.8.1...v0.9.0)

##### February 24, 2025

#### Breaking Changes 💥

- Removed deprecated methods `CompactString::new_inline(...)` and
`CompactString::from_static_str(...)`.
- Implemented in [`fix: delete methods that are documented as deprecated
in v0.9.0`](https://redirect.github.com/ParkMyCar/compact_str/pull/429)
- Changed the `CompactStringExt::join_compact` and
`CompactStringExt::concat_compact` to take a
reference (i.e. `&C`) to a type `C: IntoIterator<Item = &str>` instead
of ownership of a type `C`
    where `&C: IntoIterator<Item = &str>`.
- Fixed
[`issue#412`](https://redirect.github.com/ParkMyCar/compact_str/issues/412)
which made the
        `CompactStringExt` more ergonomic.
- Implemented in [`feat: tweak the CompactStringExt trait so
join_compact and concat_compact work
better`](https://redirect.github.com/ParkMyCar/compact_str/pull/418)

#### Changes

-   Fixed the `borsch` feature in `no_std` environments.
- Implemented in [`fix: The borsch feature with
no-std`](https://redirect.github.com/ParkMyCar/compact_str/pull/428).
- Implemented the [`zeroize::Zeroize`](https://crates.io/crates/zeroize)
trait for `CompactString`.
- Implemented in [`feat: Add support for
zeroize::Zeroize`](https://redirect.github.com/ParkMyCar/compact_str/pull/421).
- Fixed the `CompactString::retain` method to not set length if the
predicate panics.
- Implemented in [`fix: retain not set len if predicate
panics`](https://redirect.github.com/ParkMyCar/compact_str/pull/413).
-   Implement `sqlx::postgres::PgHasArrayType` for `CompactString`.
- Implemented in [`impl
sqlx::postgres::PgHasArrayType`](https://redirect.github.com/ParkMyCar/compact_str/pull/399).
- Bump the [`markup`](https://crates.io/crates/markup) dependency to
`v0.15`.
- Implemented in [`deps: upgrade to markup
v0.8`](https://redirect.github.com/ParkMyCar/compact_str/pull/415).
- Bump the [`rkyv`](https://crates.io/crates/rkyv) dependency to `v0.8`.
- Implemented in [`deps: upgrade to rkyv
v0.8`](https://redirect.github.com/ParkMyCar/compact_str/pull/409).
- Bump the [`sqlx`](https://crates.io/crates/sqlx) dependency to `v0.8`.
- Implemented in [`deps: upgrade to sqlx
v0.8`](https://redirect.github.com/ParkMyCar/compact_str/pull/408).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micha Reiser <micha@reiser.io>
2025-03-17 09:08:52 +01:00
renovate[bot]
43d371a1c9
Update Rust crate clap to v4.5.32 (#16778)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [clap](https://redirect.github.com/clap-rs/clap) |
workspace.dependencies | patch | `4.5.31` -> `4.5.32` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>clap-rs/clap (clap)</summary>

###
[`v4.5.32`](https://redirect.github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4532---2025-03-10)

[Compare
Source](https://redirect.github.com/clap-rs/clap/compare/v4.5.31...v4.5.32)

##### Features

-   Add `Error::remove`

##### Documentation

-   *(cookbook)* Switch from `humantime` to `jiff`
-   *(tutorial)* Better cover required vs optional

##### Internal

-   Update `pulldown-cmark`

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 08:04:26 +00:00
renovate[bot]
5f80129112
Update Rust crate codspeed-criterion-compat to v2.9.1 (#16784)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [codspeed-criterion-compat](https://codspeed.io)
([source](https://redirect.github.com/CodSpeedHQ/codspeed-rust)) |
workspace.dependencies | minor | `2.8.1` -> `2.9.1` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>CodSpeedHQ/codspeed-rust (codspeed-criterion-compat)</summary>

###
[`v2.9.1`](https://redirect.github.com/CodSpeedHQ/codspeed-rust/releases/tag/v2.9.1)

[Compare
Source](https://redirect.github.com/CodSpeedHQ/codspeed-rust/compare/v2.8.1...v2.9.1)

#### What's Changed

- feat: add support for all-features and no-default-features by
[@&#8203;not-matthias](https://redirect.github.com/not-matthias) in
[https://github.com/CodSpeedHQ/codspeed-rust/pull/83](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/83)
- feat: add support consts with divan by
[@&#8203;not-matthias](https://redirect.github.com/not-matthias) in
[https://github.com/CodSpeedHQ/codspeed-rust/pull/84](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/84)
- feat(cargo-codspeed): rethrow exit code by
[@&#8203;not-matthias](https://redirect.github.com/not-matthias) in
[https://github.com/CodSpeedHQ/codspeed-rust/pull/86](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/86)
- chore(divan_compat): remove consts from unsupported features in README
by
[@&#8203;GuillaumeLagrange](https://redirect.github.com/GuillaumeLagrange)
in
[https://github.com/CodSpeedHQ/codspeed-rust/pull/87](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/87)
- feat(criterion_compat): fork criterion and add walltime support by
[@&#8203;not-matthias](https://redirect.github.com/not-matthias) in
[https://github.com/CodSpeedHQ/codspeed-rust/pull/85](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/85)

#### New Contributors

- [@&#8203;not-matthias](https://redirect.github.com/not-matthias) made
their first contribution in
[https://github.com/CodSpeedHQ/codspeed-rust/pull/83](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/83)

**Full Changelog**:
https://github.com/CodSpeedHQ/codspeed-rust/compare/v2.8.1...v2.9.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 08:04:00 +00:00
renovate[bot]
db4ae242dc
Update Rust crate quote to v1.0.40 (#16782)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [quote](https://redirect.github.com/dtolnay/quote) |
workspace.dependencies | patch | `1.0.39` -> `1.0.40` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>dtolnay/quote (quote)</summary>

###
[`v1.0.40`](https://redirect.github.com/dtolnay/quote/releases/tag/1.0.40)

[Compare
Source](https://redirect.github.com/dtolnay/quote/compare/1.0.39...1.0.40)

- Optimize construction of lifetime tokens
([#&#8203;293](https://redirect.github.com/dtolnay/quote/issues/293),
thanks [@&#8203;aatifsyed](https://redirect.github.com/aatifsyed))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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.

---

- [x] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 07:55:12 +00:00
renovate[bot]
d3b5ef9f0b
Update Rust crate ordermap to v0.5.6 (#16781)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ordermap](https://redirect.github.com/indexmap-rs/ordermap) |
workspace.dependencies | patch | `0.5.5` -> `0.5.6` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>indexmap-rs/ordermap (ordermap)</summary>

###
[`v0.5.6`](https://redirect.github.com/indexmap-rs/ordermap/blob/HEAD/RELEASES.md#056-2025-03-10)

[Compare
Source](https://redirect.github.com/indexmap-rs/ordermap/compare/0.5.5...0.5.6)

- Added `ordermap_with_default!` and `orderset_with_default!` to be used
with
    alternative hashers, especially when using the crate without `std`.
-   Updated the `indexmap` dependency to version 2.8.0.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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.

---

- [x] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 07:54:44 +00:00
renovate[bot]
a7a20a3684
Update cloudflare/wrangler-action action to v3.14.1 (#16783)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[cloudflare/wrangler-action](https://redirect.github.com/cloudflare/wrangler-action)
| action | patch | `v3.14.0` -> `v3.14.1` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>cloudflare/wrangler-action
(cloudflare/wrangler-action)</summary>

###
[`v3.14.1`](https://redirect.github.com/cloudflare/wrangler-action/releases/tag/v3.14.1)

[Compare
Source](https://redirect.github.com/cloudflare/wrangler-action/compare/v3.14.0...v3.14.1)

##### Patch Changes

-
[#&#8203;358](https://redirect.github.com/cloudflare/wrangler-action/pull/358)
[`cd6314a`](cd6314a97b)
Thanks [@&#8203;penalosa](https://redirect.github.com/penalosa)! - Use
`secret bulk` instead of deprecated `secret:bulk` command

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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.

---

- [x] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 07:54:18 +00:00
renovate[bot]
6fc953119f
Update Rust crate env_logger to v0.11.7 (#16779)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [env_logger](https://redirect.github.com/rust-cli/env_logger) |
workspace.dependencies | patch | `0.11.6` -> `0.11.7` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>rust-cli/env_logger (env_logger)</summary>

###
[`v0.11.7`](https://redirect.github.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0117---2025-03-10)

[Compare
Source](https://redirect.github.com/rust-cli/env_logger/compare/v0.11.6...v0.11.7)

##### Internal

-   Replaced `humantime` with `jiff`

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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.

---

- [x] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 07:53:50 +00:00
renovate[bot]
405fc7f5cf
Update Rust crate libc to v0.2.171 (#16780)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [libc](https://redirect.github.com/rust-lang/libc) |
workspace.dependencies | patch | `0.2.170` -> `0.2.171` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>rust-lang/libc (libc)</summary>

###
[`v0.2.171`](https://redirect.github.com/rust-lang/libc/releases/tag/0.2.171)

[Compare
Source](https://redirect.github.com/rust-lang/libc/compare/0.2.170...0.2.171)

##### Added

- Android: Add `if_nameindex`/`if_freenameindex` support
([#&#8203;4247](https://redirect.github.com/rust-lang/libc/pull/4247))
- Apple: Add missing proc types and constants
([#&#8203;4310](https://redirect.github.com/rust-lang/libc/pull/4310))
- BSD: Add `devname`
([#&#8203;4285](https://redirect.github.com/rust-lang/libc/pull/4285))
- Cygwin: Add PTY and group API
([#&#8203;4309](https://redirect.github.com/rust-lang/libc/pull/4309))
- Cygwin: Add support
([#&#8203;4279](https://redirect.github.com/rust-lang/libc/pull/4279))
- FreeBSD: Make `spawn.h` interfaces available on all FreeBSD-like
systems
([#&#8203;4294](https://redirect.github.com/rust-lang/libc/pull/4294))
- Linux: Add `AF_XDP` structs for all Linux environments
([#&#8203;4163](https://redirect.github.com/rust-lang/libc/pull/4163))
- Linux: Add SysV semaphore constants
([#&#8203;4286](https://redirect.github.com/rust-lang/libc/pull/4286))
- Linux: Add `F_SEAL_EXEC`
([#&#8203;4316](https://redirect.github.com/rust-lang/libc/pull/4316))
- Linux: Add `SO_PREFER_BUSY_POLL` and `SO_BUSY_POLL_BUDGET`
([#&#8203;3917](https://redirect.github.com/rust-lang/libc/pull/3917))
- Linux: Add `devmem` structs
([#&#8203;4299](https://redirect.github.com/rust-lang/libc/pull/4299))
- Linux: Add socket constants up to `SO_DEVMEM_DONTNEED`
([#&#8203;4299](https://redirect.github.com/rust-lang/libc/pull/4299))
- NetBSD, OpenBSD, DragonflyBSD: Add `closefrom`
([#&#8203;4290](https://redirect.github.com/rust-lang/libc/pull/4290))
- NuttX: Add `pw_passwd` field to `passwd`
([#&#8203;4222](https://redirect.github.com/rust-lang/libc/pull/4222))
- Solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF`
([#&#8203;4287](https://redirect.github.com/rust-lang/libc/pull/4287))
- Wali: Add bindings for `wasm32-wali-linux-musl` target
([#&#8203;4244](https://redirect.github.com/rust-lang/libc/pull/4244))

##### Changed

- AIX: Use `sa_sigaction` instead of a union
([#&#8203;4250](https://redirect.github.com/rust-lang/libc/pull/4250))
- Make `msqid_ds.__msg_cbytes` public
([#&#8203;4301](https://redirect.github.com/rust-lang/libc/pull/4301))
- Unix: Make all `major`, `minor`, `makedev` into `const fn`
([#&#8203;4208](https://redirect.github.com/rust-lang/libc/pull/4208))

##### Deprecated

- Linux: Deprecate obsolete packet filter interfaces
([#&#8203;4267](https://redirect.github.com/rust-lang/libc/pull/4267))

##### Fixed

- Cygwin: Fix strerror_r
([#&#8203;4308](https://redirect.github.com/rust-lang/libc/pull/4308))
- Cygwin: Fix usage of f!
([#&#8203;4308](https://redirect.github.com/rust-lang/libc/pull/4308))
- Hermit: Make `stat::st_size` signed
([#&#8203;4298](https://redirect.github.com/rust-lang/libc/pull/4298))
- Linux: Correct values for `SI_TIMER`, `SI_MESGQ`, `SI_ASYNCIO`
([#&#8203;4292](https://redirect.github.com/rust-lang/libc/pull/4292))
- NuttX: Update `tm_zone` and `d_name` fields to use `c_char` type
([#&#8203;4222](https://redirect.github.com/rust-lang/libc/pull/4222))
- Xous: Include the prelude to define `c_int`
([#&#8203;4304](https://redirect.github.com/rust-lang/libc/pull/4304))

##### Other

- Add labels to FIXMEs
([#&#8203;4231](https://redirect.github.com/rust-lang/libc/pull/4231),
[#&#8203;4232](https://redirect.github.com/rust-lang/libc/pull/4232),
[#&#8203;4234](https://redirect.github.com/rust-lang/libc/pull/4234),
[#&#8203;4235](https://redirect.github.com/rust-lang/libc/pull/4235),
[#&#8203;4236](https://redirect.github.com/rust-lang/libc/pull/4236))
- CI: Fix "cannot find libc" error on Sparc64
([#&#8203;4317](https://redirect.github.com/rust-lang/libc/pull/4317))
- CI: Fix "cannot find libc" error on s390x
([#&#8203;4317](https://redirect.github.com/rust-lang/libc/pull/4317))
- CI: Pass `--no-self-update` to `rustup update`
([#&#8203;4306](https://redirect.github.com/rust-lang/libc/pull/4306))
- CI: Remove tests for the `i586-pc-windows-msvc` target
([#&#8203;4311](https://redirect.github.com/rust-lang/libc/pull/4311))
- CI: Remove the `check_cfg` job
([#&#8203;4322](https://redirect.github.com/rust-lang/libc/pull/4312))
- Change the range syntax that is giving `ctest` problems
([#&#8203;4311](https://redirect.github.com/rust-lang/libc/pull/4311))
- Linux: Split out the stat struct for gnu/b32/mips
([#&#8203;4276](https://redirect.github.com/rust-lang/libc/pull/4276))

##### Removed

- NuttX: Remove `pthread_set_name_np`
([#&#8203;4251](https://redirect.github.com/rust-lang/libc/pull/4251))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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.

---

- [x] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 07:53:36 +00:00
renovate[bot]
d5e045df47
Update Rust crate etcetera to 0.10.0 (#16786)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [etcetera](https://redirect.github.com/lunacookies/etcetera) |
workspace.dependencies | minor | `0.8.0` -> `0.10.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>lunacookies/etcetera (etcetera)</summary>

###
[`v0.10.0`](https://redirect.github.com/lunacookies/etcetera/releases/tag/v0.10.0)

[Compare
Source](https://redirect.github.com/lunacookies/etcetera/compare/v0.9.0...v0.10.0)

#### What's Changed

- Allow compatibility with recent versions of home in
[https://github.com/lunacookies/etcetera/pull/31](https://redirect.github.com/lunacookies/etcetera/pull/31)
- Support non-UTF8 dirs in
[https://github.com/lunacookies/etcetera/pull/32](https://redirect.github.com/lunacookies/etcetera/pull/32)
- Add note about MSRV & fix CI in
[https://github.com/lunacookies/etcetera/pull/33](https://redirect.github.com/lunacookies/etcetera/pull/33)

This version raises MSRV to 1.81.0. But if you pin `home` to `<0.5.11`
in `Cargo.lock`, then the MSRV will be `1.70.0`.

**Full Changelog**:
https://github.com/lunacookies/etcetera/compare/v0.9.0...v0.10.0

###
[`v0.9.0`](https://redirect.github.com/lunacookies/etcetera/releases/tag/v0.9.0)

[Compare
Source](https://redirect.github.com/lunacookies/etcetera/compare/v0.8.0...v0.9.0)

#### What's Changed

- Make macOS bundle ID match the directories crate in
[https://github.com/lunacookies/etcetera/pull/22](https://redirect.github.com/lunacookies/etcetera/pull/22)
- Make the traits dyn-compatible in
[https://github.com/lunacookies/etcetera/pull/25](https://redirect.github.com/lunacookies/etcetera/pull/25)
- windows-sys: bump & replace SHGetFolderPathW with SHGetKnownFolderPath
in
[https://github.com/lunacookies/etcetera/pull/30](https://redirect.github.com/lunacookies/etcetera/pull/30)
- crate: bump to edition 2021 & raise MSRV to 1.70.0 in
[https://github.com/lunacookies/etcetera/pull/30](https://redirect.github.com/lunacookies/etcetera/pull/30)

**Full Changelog**:
https://github.com/lunacookies/etcetera/compare/v0.8.0...v0.9.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 07:52:58 +00:00
renovate[bot]
adac1e6a61
Update Rust crate indexmap to v2.8.0 (#16787)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [indexmap](https://redirect.github.com/indexmap-rs/indexmap) |
workspace.dependencies | minor | `2.7.1` -> `2.8.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>indexmap-rs/indexmap (indexmap)</summary>

###
[`v2.8.0`](https://redirect.github.com/indexmap-rs/indexmap/blob/HEAD/RELEASES.md#280-2025-03-10)

[Compare
Source](https://redirect.github.com/indexmap-rs/indexmap/compare/2.7.1...2.8.0)

- Added `indexmap_with_default!` and `indexset_with_default!` to be used
with
    alternative hashers, especially when using the crate without `std`.
-   Implemented `PartialEq` between each `Slice` and `[]`/arrays.
-   Removed the internal `rustc-rayon` feature and dependency.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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.

---

- [x] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 07:52:51 +00:00
Micha Reiser
3768f9cb52
Instruct Renovate to pin GitHub Actions based on SHA (#16789)
## Summary

The intent here is that all actions should be pinned to an immutable SHA
(but that Renovate should annotate each SHA with the corresponding
SemVer version).

See https://github.com/astral-sh/uv/pull/12189

## Test plan

```
npx --yes --package renovate -- renovate-config-validator
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@2.4.5: Rimraf versions prior to v4 are no longer supported
npm warn deprecated boolean@3.2.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated glob@6.0.4: Glob versions prior to v9 are no longer supported
 INFO: Validating .github/renovate.json5
 INFO: Config validated successfully

```
2025-03-17 07:44:59 +00:00
Micha Reiser
01f3ef4e4f
[ci]: Remove changed files actions (#16788)
## Summary

tj-actions/changed-files no longer exists due to a malicious commit.
This PR removes it so that we can re-enable CI.

We can follow up with a proper replacement in a separate PR
2025-03-17 08:20:09 +01:00
Carl Meyer
2de8455e43
[red-knot] LSP: only emit WARN logs from non-red-knot sources (#16760)
Currently the red-knot LSP server emits any log messages of level `INFO`
or higher from non-red-knot crates. This makes its output quite verbose,
because Salsa emits an `INFO` level message every time it executes a
query. I use red-knot as LSP with neovim, and this spams the log file
quite a lot.

It seems like a better default to only emit `WARN` or higher messages
from non-red-knot sources.

I confirmed that this fixes the nvim LSP log spam.
2025-03-15 08:47:50 -07:00
github-actions[bot]
1fab292ec1
Sync vendored typeshed stubs (#16762)
Close and reopen this PR to trigger CI

Co-authored-by: typeshedbot <>
2025-03-15 00:38:58 +00:00
David Peter
c755eec91e
[red-knot] Extend ecosystem checks (#16761)
## Summary

The ecosystem checks have proven useful so far, so I'm extending the
list a bit. My main selection criteria are:

- Few dependencies (we don't understand -stubs/-types packages yet)
- Fewer than 1000 diagnostics
- No panics

## Test Plan

Ran it locally. We now have ~2k diagnostics in total, across 12 projects
2025-03-14 22:17:38 +01:00
David Peter
ebcad6e641
[red-knot] Use try_call_dunder for augmented assignment (#16717)
## Summary

Uses the `try_call_dunder` infrastructure for augmented assignment and
fixes the logic to work for types other than `Type::Instance(…)`. This
allows us to infer the correct type here:
```py
x = (1, 2)
x += (3, 4)
reveal_type(x)  # revealed: tuple[Literal[1], Literal[2], Literal[3], Literal[4]]
```
Or in this (extremely weird) scenario:
```py
class Meta(type):
    def __iadd__(cls, other: int) -> str:
        return ""

class C(metaclass=Meta): ...

cls = C
cls += 1

reveal_type(cls)  # revealed: str
```

Union and intersection handling could also be improved here, but I made
no attempt to do so in this PR.

## Test Plan

New MD tests
2025-03-14 20:36:09 +01:00
David Peter
fe275725e0
[red-knot] Document current state of attribute assignment diagnostics (#16746)
## Summary

A follow-up to https://github.com/astral-sh/ruff/pull/16705 which
documents various kinds of diagnostics that can appear when assigning to
an attribute.

## Test Plan

New snapshot tests.
2025-03-14 20:34:43 +01:00
Micha Reiser
a467e7c8d3
[red-knot] Case sensitive module resolver (#16521)
## Summary

This PR implements the first part of
https://github.com/astral-sh/ruff/discussions/16440. It ensures that Red
Knot's module resolver is case sensitive on all systems.

This PR combines a few approaches:

1. It uses `canonicalize` on non-case-sensitive systems to get the real
casing of a path. This works for as long as no symlinks or mapped
network drives (the windows `E:\` is mapped to `\\server\share` thingy).
This is the same as what Pyright does
2. If 1. fails, fall back to recursively list the parent directory and
test if the path's file name matches the casing exactly as listed in by
list dir. This is the same approach as CPython takes in its module
resolver. The main downside is that it requires more syscalls because,
unlike CPython, we Red Knot needs to invalidate its caches if a file
name gets renamed (CPython assumes that the folders are immutable).

It's worth noting that the file watching test that I added that renames
`lib.py` to `Lib.py` currently doesn't pass on case-insensitive systems.
Making it pass requires some more involved changes to `Files`. I plan to
work on this next. There's the argument that landing this PR on its own
isn't worth it without this issue being addressed. I think it's still a
good step in the right direction even when some of the details on how
and where the path case sensitive comparison is implemented.

## Test plan

I added multiple integration tests (including a failing one). I tested
that the `case-sensitivity` detection works as expected on Windows,
MacOS and Linux and that the fast-paths are taken accordingly.
2025-03-14 19:16:44 +00:00
Micha Reiser
a128ca761f
[red-knot] Very minor simplification of the render tests (#16759) 2025-03-14 19:13:07 +00:00
Brent Westbrook
3a32e56445
[syntax-errors] Unparenthesized assignment expressions in sets and indexes (#16404)
## Summary
This PR detects unparenthesized assignment expressions used in set
literals and comprehensions and in sequence indexes. The link to the
release notes in https://github.com/astral-sh/ruff/issues/6591 just has
this entry:
> * Assignment expressions can now be used unparenthesized within set
literals and set comprehensions, as well as in sequence indexes (but not
slices).

with no other information, so hopefully the test cases I came up with
cover all of the changes. I also tested these out in the Python REPL and
they actually worked in Python 3.9 too. I'm guessing this may be another
case that was "formally made part of the language spec in Python 3.10,
but usable -- and commonly used -- in Python >=3.9" as @AlexWaygood
added to the body of #6591 for context managers. So we may want to
change the version cutoff, but I've gone along with the release notes
for now.

## Test Plan

New inline parser tests and linter CLI tests.
2025-03-14 15:06:42 -04:00
Andrew Gallant
b9d7c36a23 ruff_db: add a new diagnostic renderer
We don't actually hook this up to anything in this PR, but we do
go to some trouble to granularly unit test it. The unit tests caught
plenty of bugs after I initially wrote down the implementation, so they
were very much worth it.

Closes #16506
2025-03-14 14:59:33 -04:00
Andrew Gallant
ef9a825827 ruff_db: add context configuration
Instead of hard-coding a specific context window,
it seemed prudent to make this configurable. That
makes it easier to test different context window
sizes as well.

I am not totally convinced that this is the right
place for this configuration. I could see the context
window size being a property of `Diagnostic` instead,
since we might want to change the context window
size based not just on some end user configuration,
but perhaps also the specific diagnostic.

But for now, I think it's fine for it to live here,
and all of the rendering logic doesn't care where
it lives. So it should be relatively easy to change
in the future.
2025-03-14 14:59:33 -04:00
Andrew Gallant
2bcd2b4147 red_knot: plumb through DiagnosticFormat to the CLI
The CLI calls this `OutputFormat`, and so does the type where the CLI is
defined. But it's called `DiagnosticFormat` in `ruff_db` to be
consistent with `DisplayDiagnosticConfig`.

Ref https://github.com/astral-sh/ruff/issues/15697#issuecomment-2706477278
2025-03-14 14:46:17 -04:00
Andrew Gallant
eb6871d209 ruff_db: add concise diagnostic mode
This adds a new configuration knob to diagnostic rendering that, when
enabled, will make diagnostic rendering much more terse. Specifically,
it will guarantee that each diagnostic will only use one line.

This doesn't actually hook the concise output option up to anything.
We'll do that plumbing in the next commit.
2025-03-14 14:46:17 -04:00
Brent Westbrook
6311412373
[syntax-errors] Star annotations before Python 3.11 (#16545)
Summary
--

This is closely related to (and stacked on)
https://github.com/astral-sh/ruff/pull/16544 and detects star
annotations in function definitions.

I initially called the variant `StarExpressionInAnnotation` to mirror
`StarExpressionInIndex`, but I realized it's not really a "star
expression" in this position and renamed it. `StarAnnotation` seems in
line with the PEP.

Test Plan
--

Two new inline tests. It looked like there was pretty good existing
coverage of this syntax, so I just added simple examples to test the
version cutoff.
2025-03-14 15:20:44 +00:00
Brent Westbrook
4f2851982d
[syntax-errors] Star expression in index before Python 3.11 (#16544)
Summary
--

This PR detects tuple unpacking expressions in index/subscript
expressions before Python 3.11.

Test Plan
--

New inline tests
2025-03-14 14:51:34 +00:00
Micha Reiser
2cd25ef641
Ruff 0.11.0 (#16723)
## Summary

Follow-up release for Ruff v0.10 that now includes the following two
changes that we intended to ship but slipped:

* Changes to how the Python version is inferred when a `target-version`
is not specified (#16319)
* `blanket-noqa` (`PGH004`): Also detect blanked file-level noqa
comments (and not just line level comments).

## Test plan

I verified that the binary built on this branch respects the
`requires-python` setting
([logs](https://www.diffchecker.com/qyJWYi6W/), left: v0.10, right:
v0.11)
2025-03-14 13:57:56 +01:00
David Peter
a22d206db2
[red-knot] Preliminary tests for typing.Final (#15917)
## Summary

WIP.

Adds some preliminary tests for `typing.Final`.

## Test Plan

New MD tests
2025-03-14 12:30:13 +01:00
cake-monotone
270318c2e0
[red-knot] fix: improve type inference for binary ops on tuples (#16725)
## Summary

This PR includes minor improvements to binary operation inference,
specifically for tuple concatenation.

### Before

```py
reveal_type((1, 2) + (3, 4))  # revealed: @Todo(return type of decorated function)
# If TODO is ignored, the revealed type would be `tuple[1|2|3|4, ...]`
```

The `builtins.tuple` type stub defines `__add__`, but it appears to only
work for homogeneous tuples. However, I think this limitation is not
ideal for many use cases.

### After

```py
reveal_type((1, 2) + (3, 4))  # revealed: tuple[Literal[1], Literal[2], Literal[3], Literal[4]]
```

## Test Plan

### Added
- `mdtest/binary/tuples.md`

### Affected
- `mdtest/slots.md` (a test have been moved out of the `False-Negative`
block.)
2025-03-14 12:29:57 +01:00
David Peter
d03b12e711
[red-knot] Assignments to attributes (#16705)
## Summary

This changeset adds proper support for assignments to attributes:
```py
obj.attr = value
```

In particular, the following new features are now available:

* We previously didn't raise any errors if you tried to assign to a
non-existing attribute `attr`. This is now fixed.
* If `type(obj).attr` is a data descriptor, we now call its `__set__`
method instead of trying to assign to the load-context type of
`obj.attr`, which can be different for data descriptors.
* An initial attempt was made to support unions and intersections, as
well as possibly-unbound situations. There are some remaining TODOs in
tests, but they only affect edge cases. Having nested diagnostics would
be one way that could help solve the remaining cases, I believe.

## Follow ups

The following things are planned as follow-ups:

- Write a test suite with snapshot diagnostics for various attribute
assignment errors
- Improve the diagnostics. An easy improvement would be to highlight the
right hand side of the assignment as a secondary span (with the rhs type
as additional information). Some other ideas are mentioned in TODO
comments in this PR.
- Improve the union/intersection/possible-unboundness handling
- Add support for calling custom `__setattr__` methods (see new false
positive in the ecosystem results)

## Ecosystem changes

Some changes are related to assignments on attributes with a custom
`__setattr__` method (see above). Since we didn't notice missing
attributes at all in store context previously, these are new.

The other changes are related to properties. We previously used their
read-context type to test the assignment. That results in weird error
messages, as we often see assignments to `self.property` and then we
think that those are instance attributes *and* descriptors, leading to
union types. Now we properly look them up on the meta type, see the
decorated function, and try to overwrite it with the new value (as we
don't understand decorators yet). Long story short: the errors are still
weird, we need to understand decorators to make them go away.

## Test Plan

New Markdown tests
2025-03-14 12:15:41 +01:00
Micha Reiser
14c5ed5d7d
[pygrep-hooks]: Detect file-level suppressions comments without rul… (#16720)
## Summary

I accidentially dropped this commit from the Ruff 0.10 release. See
https://github.com/astral-sh/ruff/pull/16699
2025-03-14 09:37:16 +01:00
Micha Reiser
595565015b
Fallback to requires-python in certain cases when target-version is not found (#16721)
## Summary

Restores https://github.com/astral-sh/ruff/pull/16319 after it got
dropped from the 0.10 release branch :(

---------

Co-authored-by: dylwil3 <dylwil3@gmail.com>
2025-03-14 09:36:51 +01:00
Brent Westbrook
2382fe1f25
[syntax-errors] Tuple unpacking in for statement iterator clause before Python 3.9 (#16558)
Summary
--

This PR reuses a slightly modified version of the
`check_tuple_unpacking` method added for detecting unpacking in `return`
and `yield` statements to detect the same issue in the iterator clause
of `for` loops.

I ran into the same issue with a bare `for x in *rest: ...` example
(invalid even on Python 3.13) and added it as a comment on
https://github.com/astral-sh/ruff/issues/16520.

I considered just making this an additional `StarTupleKind` variant as
well, but this change was in a different version of Python, so I kept it
separate.

Test Plan
--

New inline tests.
2025-03-13 15:55:17 -04:00
Micha Reiser
27e9d1fe3e
Ruff v0.10 Release (#16708)
Co-authored-by: dylwil3 <dylwil3@gmail.com>
Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
2025-03-13 13:53:11 -04:00
Brent Westbrook
acf35c55f8
Add new noqa specification to the docs (#16703)
## Summary

Adds @dylwil3's new `noqa` specification to the linter `Error
suppression` page instead of the release blog post. Originally taken
from his PR comment
[here](https://github.com/astral-sh/ruff/pull/16483#issuecomment-2711985479).

## Test Plan

None
2025-03-13 12:48:53 -04:00
Dylan
b9b256209b
describe requires-python fallback in docs (#16704)
Adds description of `requires-python` fallback to documentation for
configuration file discovery.

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
2025-03-13 11:48:12 -05:00
Carl Meyer
abaa18993b
[red-knot] handle cycles in MRO/bases resolution (#16693)
There can be semi-cyclic inheritance patterns (e.g. recursive generics)
that are not technically inheritance cycles, but that can cause us to
hit Salsa query cycles in evaluating a type's MRO. Add fixed-point
handling to these MRO-related queries so we don't panic on these cycles.

The details of what queries we hit in what order in this case will
change as we implement support for generics, but ultimately we will
probably need cycle handling for all queries that can re-enter type
inference, otherwise we are susceptible to small changes in query
execution order causing panics.

Fixes #14333
Further reduces the panicking set of seeds in #14737
2025-03-13 08:16:03 -07:00
Shaygan Hooshyari
360ba095ff
[red-knot] Auto generate statement nodes (#16645)
<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

Part of #15655 

Replaced statement nodes with autogenerated ones. Reused the stuff we
introduced in #16285. Nothing except for copying the nodes to new
format.

## Test Plan

Tests run without any changes. Also moved the test that checks size of
AST nodes to `generated.rs` since all of the structs that it tests are
now there.
<!-- How was it tested? -->
2025-03-13 15:43:48 +01:00
Micha Reiser
d8159e816f [pylint] Better inference for str.strip (PLE310) (#16671)
## Summary
This PR stabilizes the behavior introduced in
https://github.com/astral-sh/ruff/pull/15985

The new behavior improves the inference of `str.strip` calls:

* before: The rule only considered calls on string or byte literals
(`"abcd".strip`)
* now: The rule also catches calls to `strip` on object where the type
is known to be a `str` or `bytes` (e.g. `a = "abc"; a.strip("//")`)


The new behavior shipped as part of Ruff 0.9.6 on the 10th of Feb which
is a little more than a month ago.
There have been now new issues or PRs related to the new behavior.
2025-03-13 15:37:37 +01:00
Micha Reiser
04ad562afd [pylint] Improve repeated-equality-comparison fix to use a set when all elements are hashable (PLR1714) (#16685)
## Summary

This PR promotes the fix improvements for `PLR1714` that were introduced
in https://github.com/astral-sh/ruff/pull/14372/ to stable.

The improvement is that the fix now proposes to use a set if all
elements are hashable:

```
foo == "bar" or foo == "baz" or foo == "qux"
```

Gets fixed to 

```py
foo in {"bar", "baz", "qux"}
```

where it previously always got fixed to a tuple.

The new fix was first released in ruff 0.8.0 (Nov last year). This is
not a breaking change. The change was preview gated only to get some
extra test coverage.


There are no open issues or PRs related to this changed fix behavior.
2025-03-13 15:37:37 +01:00