mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
9537 commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
![]() |
31180a84e4
|
Fix unstable formatting of trailing end-of-line comments of parenthesized attribute values (#16187) | ||
![]() |
82eae511ca
|
Ignore source code actions for a notebook cell (#16154)
Some checks are pending
CI / cargo fuzz build (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
## Summary Related to https://github.com/astral-sh/ruff-vscode/pull/686, this PR ignores handling source code actions for notebooks which are not prefixed with `notebook`. The main motivation is that the native server does not actually handle it well which results in gibberish code. There's some context about this in https://github.com/astral-sh/ruff-vscode/issues/680#issuecomment-2647490812 and the following comments. closes: https://github.com/astral-sh/ruff-vscode/issues/680 ## Test Plan Running a notebook with the following does nothing except log the message: ```json "notebook.codeActionsOnSave": { "source.organizeImports.ruff": "explicit", }, ``` while, including the `notebook` code actions does make the edit (as usual): ```json "notebook.codeActionsOnSave": { "notebook.source.organizeImports.ruff": "explicit" }, ``` |
||
![]() |
b5cd4f2f70
|
Add FAQ entry for source.* code actions in Notebook (#16212)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
## Summary This PR adds a FAQ entry to provide a brief explanation on why Ruff does not support `source.*` code actions for Notebook. |
||
![]() |
9f111eaebf
|
red-knot: move symbol lookups in symbol.rs (#16152)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
## Summary This PR does the following: * Moves the following from `types.rs` in `symbol.rs`: * `symbol` * `global_symbol` * `imported_symbol` * `symbol_from_bindings` * `symbol_from_declarations` * `SymbolAndQualifiers` * `SymbolFromDeclarationsResult` * Moves the following from `stdlib.rs` in `symbol.rs` and removes `stdlib.rs`: * `known_module_symbol` * `builtins_symbol` * `typing_symbol` (only for tests) * `typing_extensions_symbol` * `builtins_module_scope` * `core_module_scope` * Add `symbol_from_bindings_impl` and `symbol_from_declarations_impl` to keep `RequiresExplicitReExport` an implementation detail * Make `declaration_type` a `pub(crate)` as it's required in `symbol_from_declarations` (`binding_type` is already `pub(crate)` The main motivation is to keep the implementation details private and only expose an ergonomic API which uses sane defaults for various scenario to avoid any mistakes from the caller. Refer to https://github.com/astral-sh/ruff/pull/16133#discussion_r1955262772, https://github.com/astral-sh/ruff/pull/16133#issue-2850146612 for details. |
||
![]() |
9304fdf4ec
|
better error messages while loading configuration extend s (#15658)
Co-authored-by: Micha Reiser <micha@reiser.io> |
||
![]() |
0babbca43f
|
Format index.css (#16207)
## Summary I did ran the NPM dev commands before merging https://github.com/astral-sh/ruff/pull/16199 but I didn't notice that one file got reformatted. This PR formats the `index.css` with the now used Prettier version. |
||
![]() |
b6b1947010
|
Improve API exposed on ExprStringLiteral nodes (#16192)
## Summary This PR makes the following changes: - It adjusts various callsites to use the new `ast::StringLiteral::contents_range()` method that was introduced in https://github.com/astral-sh/ruff/pull/16183. This is less verbose and more type-safe than using the `ast::str::raw_contents()` helper function. - It adds a new `ast::ExprStringLiteral::as_unconcatenated_literal()` helper method, and adjusts various callsites to use it. This addresses @MichaReiser's review comment at https://github.com/astral-sh/ruff/pull/16183#discussion_r1957334365. There is no functional change here, but it helps readability to make it clearer that we're differentiating between implicitly concatenated strings and unconcatenated strings at various points. - It renames the `StringLiteralValue::flags()` method to `StringLiteralFlags::first_literal_flags()`. If you're dealing with an implicitly concatenated string `string_node`, `string_node.value.flags().closer_len()` could give an incorrect result; this renaming makes it clearer that the `StringLiteralFlags` instance returned by the method is only guaranteed to give accurate information for the first `StringLiteral` contained in the `ExprStringLiteral` node. - It deletes the unused `BytesLiteralValue::flags()` method. This seems prone to misuse in the same way as `StringLiteralValue::flags()`: if it's an implicitly concatenated bytestring, the `BytesLiteralFlags` instance returned by the method would only give accurate information for the first `BytesLiteral` in the bytestring. ## Test Plan `cargo test` |
||
![]() |
21999b3be7
|
Update Rust crate tempfile to v3.17.0 (#16202)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [tempfile](https://stebalien.com/projects/tempfile-rs/) ([source](https://redirect.github.com/Stebalien/tempfile)) | workspace.dependencies | minor | `3.16.0` -> `3.17.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>Stebalien/tempfile (tempfile)</summary> ### [`v3.17.0`](https://redirect.github.com/Stebalien/tempfile/blob/HEAD/CHANGELOG.md#3170) [Compare Source](https://redirect.github.com/Stebalien/tempfile/compare/v3.16.0...v3.17.0) - Make sure to use absolute paths in when creating unnamed temporary files (avoids a small race in the "immediate unlink" logic) and in `Builder::make_in` (when creating temporary files of arbitrary types). - Prevent a theoretical crash that could (maybe) happen when a temporary file is created from a drop function run in a TLS destructor. Nobody has actually reported a case of this happening in practice and I have been unable to create this scenario in a test. - When reseeding with `getrandom`, use platform (e.g., CPU) specific randomness sources where possible. - Clarify some documentation. - Unlink unnamed temporary files on windows *immediately* when possible instead of waiting for the handle to be closed. We open files with "Unix" semantics, so this is generally possible. </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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE2Ny4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Micha Reiser <micha@reiser.io> |
||
![]() |
1ecc6a0d19
|
Update cloudflare/wrangler-action action to v3.14.0 (#16203)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [cloudflare/wrangler-action](https://redirect.github.com/cloudflare/wrangler-action) | action | minor | `v3.13.1` -> `v3.14.0` | --- > [!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.0`](https://redirect.github.com/cloudflare/wrangler-action/releases/tag/v3.14.0) [Compare Source](https://redirect.github.com/cloudflare/wrangler-action/compare/v3.13.1...v3.14.0) ##### Minor Changes - [#​351](https://redirect.github.com/cloudflare/wrangler-action/pull/351) [`4ff07f4`]( |
||
![]() |
79f43c9cab
|
Update NPM Development dependencies (#16199)
This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@cloudflare/workers-types](https://redirect.github.com/cloudflare/workerd) | [`4.20250204.0` -> `4.20250214.0`](https://renovatebot.com/diffs/npm/@cloudflare%2fworkers-types/4.20250204.0/4.20250214.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@types/react](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react) ([source](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react)) | [`19.0.8` -> `19.0.9`](https://renovatebot.com/diffs/npm/@types%2freact/19.0.8/19.0.9) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://redirect.github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | [`8.23.0` -> `8.24.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.23.0/8.24.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://redirect.github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | [`8.23.0` -> `8.24.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.23.0/8.24.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [miniflare](https://redirect.github.com/cloudflare/workers-sdk/tree/main/packages/miniflare#readme) ([source](https://redirect.github.com/cloudflare/workers-sdk/tree/HEAD/packages/miniflare)) | [`3.20250129.0` -> `3.20250204.1`](https://renovatebot.com/diffs/npm/miniflare/3.20250129.0/3.20250204.1) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [postcss](https://postcss.org/) ([source](https://redirect.github.com/postcss/postcss)) | [`8.5.1` -> `8.5.2`](https://renovatebot.com/diffs/npm/postcss/8.5.1/8.5.2) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [prettier](https://prettier.io) ([source](https://redirect.github.com/prettier/prettier)) | [`3.5.0` -> `3.5.1`](https://renovatebot.com/diffs/npm/prettier/3.5.0/3.5.1) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [wrangler](https://redirect.github.com/cloudflare/workers-sdk) ([source](https://redirect.github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler)) | [`3.107.3` -> `3.109.1`](https://renovatebot.com/diffs/npm/wrangler/3.107.3/3.109.1) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>cloudflare/workerd (@​cloudflare/workers-types)</summary> ### [`v4.20250214.0`]( |
||
![]() |
4ea397adb0
|
Update Rust crate smallvec to v1.14.0 (#16201)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [smallvec](https://redirect.github.com/servo/rust-smallvec) | workspace.dependencies | minor | `1.13.2` -> `1.14.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>servo/rust-smallvec (smallvec)</summary> ### [`v1.14.0`](https://redirect.github.com/servo/rust-smallvec/releases/tag/v1.14.0) [Compare Source](https://redirect.github.com/servo/rust-smallvec/compare/v1.13.2...v1.14.0) #### What's Changed - Implement `MallocSizeOf` for SmallVec (v1) by [@​nicoburns](https://redirect.github.com/nicoburns) in [https://github.com/servo/rust-smallvec/pull/370](https://redirect.github.com/servo/rust-smallvec/pull/370) #### New Contributors - [@​nicoburns](https://redirect.github.com/nicoburns) made their first contribution in [https://github.com/servo/rust-smallvec/pull/370](https://redirect.github.com/servo/rust-smallvec/pull/370) **Full Changelog**: https://github.com/servo/rust-smallvec/compare/v1.13.2...v1.14.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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE2Ny4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> |
||
![]() |
033f16233d
|
Update Rust crate codspeed-criterion-compat to v2.8.0 (#16200)
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.7.2` -> `2.8.0` | --- > [!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.8.0`](https://redirect.github.com/CodSpeedHQ/codspeed-rust/releases/tag/v2.8.0) [Compare Source](https://redirect.github.com/CodSpeedHQ/codspeed-rust/compare/v2.7.2...v2.8.0) #### What's Changed This introduces Divan compatibility layer and also Wall Time support. Check out the documentation to try it out [here](https://docs.codspeed.io/benchmarks/rust/divan). ##### Details - ci: bump actions/checkout to v4 by [@​fargito](https://redirect.github.com/fargito) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/56](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/56) - docs: simplify rust benchmarks definition by [@​adriencaccia](https://redirect.github.com/adriencaccia) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/44](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/44) - Support walltime runs with divan by [@​art049](https://redirect.github.com/art049) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/66](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/66) - Make `cargo-codspeed` build targets to different directories between walltime and instrumented by [@​GuillaumeLagrange](https://redirect.github.com/GuillaumeLagrange) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/68](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/68) - feat: make codspeed raw results in the walltime directory as well by [@​GuillaumeLagrange](https://redirect.github.com/GuillaumeLagrange) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/70](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/70) - chore: add an internal divan fork by [@​art049](https://redirect.github.com/art049) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/69](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/69) - Add codspeed<>divan compat layer by [@​GuillaumeLagrange](https://redirect.github.com/GuillaumeLagrange) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/65](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/65) - fix: only show walltime collection warning when appropriate by [@​art049](https://redirect.github.com/art049) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/71](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/71) - feat(divan_compat): support types and manage types and args in codspeed uri by [@​GuillaumeLagrange](https://redirect.github.com/GuillaumeLagrange) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/72](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/72) - feat: add some TheAlgorithm benches by [@​art049](https://redirect.github.com/art049) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/73](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/73) - Add divan_compat msrv check in CI by [@​GuillaumeLagrange](https://redirect.github.com/GuillaumeLagrange) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/74](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/74) - feat: add readme to divan_compat by [@​GuillaumeLagrange](https://redirect.github.com/GuillaumeLagrange) in [https://github.com/CodSpeedHQ/codspeed-rust/pull/75](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/75) #### New Contributors - [@​fargito](https://redirect.github.com/fargito) made their first contribution in [https://github.com/CodSpeedHQ/codspeed-rust/pull/56](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/56) #### New Contributors - [@​fargito](https://redirect.github.com/fargito) made their first contribution in [https://github.com/CodSpeedHQ/codspeed-rust/pull/56](https://redirect.github.com/CodSpeedHQ/codspeed-rust/pull/56) **Full Changelog**: https://github.com/CodSpeedHQ/codspeed-rust/compare/v2.7.2...v2.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. --- - [ ] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE2Ny4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> |
||
![]() |
b10be97eae
|
Update Rust crate strum to v0.27.1 (#16195)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [strum](https://redirect.github.com/Peternator7/strum) | workspace.dependencies | patch | `0.27.0` -> `0.27.1` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>Peternator7/strum (strum)</summary> ### [`v0.27.1`](https://redirect.github.com/Peternator7/strum/blob/HEAD/CHANGELOG.md#0271) [Compare Source](https://redirect.github.com/Peternator7/strum/compare/v0.27.0...v0.27.1) - [#​414](https://redirect.github.com/Peternator7/strum/pull/414): Fix docrs build error. - [#​417](https://redirect.github.com/Peternator7/strum/pull/417): Mention `parse_error_ty` and `parse_error_fn` that had been left out of the docs accidentally. - [#​421](https://redirect.github.com/Peternator7/strum/pull/421)[#​331](https://redirect.github.com/Peternator7/strum/pull/331): Implement `#[strum(transparent)]` attribute on `IntoStaticStr`, `Display` and `AsRefStr` that forwards the implmenentation to the inner value. Note that for static strings, the inner value must be convertible to an `&'static str`. ```rust #[derive(strum::Display)] enum SurveyResponse { Yes, No, #[strum(transparent)] Other(String) } fn main() { let response = SurveyResponse::Other("It was good".into()); println!("Question: Did you have fun?"); println!("Answer: {}", response); // prints: Answer: It was good } ``` </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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE2Ny4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> |
||
![]() |
f3743e30d0
|
Update Rust crate clap to v4.5.29 (#16194)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [clap](https://redirect.github.com/clap-rs/clap) | workspace.dependencies | patch | `4.5.28` -> `4.5.29` | --- > [!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.29`](https://redirect.github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4529---2025-02-11) [Compare Source](https://redirect.github.com/clap-rs/clap/compare/v4.5.28...v4.5.29) ##### Fixes - Change `ArgMatches::args_present` so not-present flags are considered not-present (matching the documentation) </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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE2Ny4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> |
||
![]() |
4d083e579d
|
Update Rust crate strum_macros to v0.27.1 (#16196)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [strum_macros](https://redirect.github.com/Peternator7/strum) | workspace.dependencies | patch | `0.27.0` -> `0.27.1` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>Peternator7/strum (strum_macros)</summary> ### [`v0.27.1`](https://redirect.github.com/Peternator7/strum/blob/HEAD/CHANGELOG.md#0271) [Compare Source](https://redirect.github.com/Peternator7/strum/compare/v0.27.0...v0.27.1) - [#​414](https://redirect.github.com/Peternator7/strum/pull/414): Fix docrs build error. - [#​417](https://redirect.github.com/Peternator7/strum/pull/417): Mention `parse_error_ty` and `parse_error_fn` that had been left out of the docs accidentally. - [#​421](https://redirect.github.com/Peternator7/strum/pull/421)[#​331](https://redirect.github.com/Peternator7/strum/pull/331): Implement `#[strum(transparent)]` attribute on `IntoStaticStr`, `Display` and `AsRefStr` that forwards the implmenentation to the inner value. Note that for static strings, the inner value must be convertible to an `&'static str`. ```rust #[derive(strum::Display)] enum SurveyResponse { Yes, No, #[strum(transparent)] Other(String) } fn main() { let response = SurveyResponse::Other("It was good".into()); println!("Question: Did you have fun?"); println!("Answer: {}", response); // prints: Answer: It was good } ``` </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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE2Ny4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> |
||
![]() |
7899e8756e
|
Update pre-commit dependencies (#16198)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [astral-sh/ruff-pre-commit](https://redirect.github.com/astral-sh/ruff-pre-commit) | repository | patch | `v0.9.5` -> `v0.9.6` | | [crate-ci/typos](https://redirect.github.com/crate-ci/typos) | repository | patch | `v1.29.5` -> `v1.29.7` | | [rbubley/mirrors-prettier](https://redirect.github.com/rbubley/mirrors-prettier) | repository | minor | `v3.4.2` -> `v3.5.1` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. Note: The `pre-commit` manager in Renovate is not supported by the `pre-commit` maintainers or community. Please do not report any problems there, instead [create a Discussion in the Renovate repository](https://redirect.github.com/renovatebot/renovate/discussions/new) if you have any questions. --- ### Release Notes <details> <summary>astral-sh/ruff-pre-commit (astral-sh/ruff-pre-commit)</summary> ### [`v0.9.6`](https://redirect.github.com/astral-sh/ruff-pre-commit/releases/tag/v0.9.6) [Compare Source](https://redirect.github.com/astral-sh/ruff-pre-commit/compare/v0.9.5...v0.9.6) See: https://github.com/astral-sh/ruff/releases/tag/0.9.6 </details> <details> <summary>crate-ci/typos (crate-ci/typos)</summary> ### [`v1.29.7`](https://redirect.github.com/crate-ci/typos/releases/tag/v1.29.7) [Compare Source](https://redirect.github.com/crate-ci/typos/compare/v1.29.6...v1.29.7) #### \[1.29.7] - 2025-02-13 ##### Fixes - Don't correct `implementors` ### [`v1.29.6`](https://redirect.github.com/crate-ci/typos/releases/tag/v1.29.6) [Compare Source](https://redirect.github.com/crate-ci/typos/compare/v1.29.5...v1.29.6) #### \[1.29.6] - 2025-02-13 ##### Features - Updated the dictionary with the [January 2025](https://redirect.github.com/crate-ci/typos/issues/1200) changes </details> <details> <summary>rbubley/mirrors-prettier (rbubley/mirrors-prettier)</summary> ### [`v3.5.1`](https://redirect.github.com/rbubley/mirrors-prettier/compare/v3.5.0...v3.5.1) [Compare Source](https://redirect.github.com/rbubley/mirrors-prettier/compare/v3.5.0...v3.5.1) ### [`v3.5.0`](https://redirect.github.com/rbubley/mirrors-prettier/compare/v3.4.2...v3.5.0) [Compare Source](https://redirect.github.com/rbubley/mirrors-prettier/compare/v3.4.2...v3.5.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. 👻 **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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE2Ny4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> |
||
![]() |
f3d1bf845e
|
Update dependency ruff to v0.9.6 (#16197)
This PR contains the following updates: | Package | Change | Age | Adoption | Passing | 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.9.5` -> `==0.9.6` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.9.6`](https://redirect.github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#096) [Compare Source](https://redirect.github.com/astral-sh/ruff/compare/0.9.5...0.9.6) ##### Preview features - \[`airflow`] Add `external_task.{ExternalTaskMarker, ExternalTaskSensor}` for `AIR302` ([#​16014](https://redirect.github.com/astral-sh/ruff/pull/16014)) - \[`flake8-builtins`] Make strict module name comparison optional (`A005`) ([#​15951](https://redirect.github.com/astral-sh/ruff/pull/15951)) - \[`flake8-pyi`] Extend fix to Python <= 3.9 for `redundant-none-literal` (`PYI061`) ([#​16044](https://redirect.github.com/astral-sh/ruff/pull/16044)) - \[`pylint`] Also report when the object isn't a literal (`PLE1310`) ([#​15985](https://redirect.github.com/astral-sh/ruff/pull/15985)) - \[`ruff`] Implement `indented-form-feed` (`RUF054`) ([#​16049](https://redirect.github.com/astral-sh/ruff/pull/16049)) - \[`ruff`] Skip type definitions for `missing-f-string-syntax` (`RUF027`) ([#​16054](https://redirect.github.com/astral-sh/ruff/pull/16054)) ##### Rule changes - \[`flake8-annotations`] Correct syntax for `typing.Union` in suggested return type fixes for `ANN20x` rules ([#​16025](https://redirect.github.com/astral-sh/ruff/pull/16025)) - \[`flake8-builtins`] Match upstream module name comparison (`A005`) ([#​16006](https://redirect.github.com/astral-sh/ruff/pull/16006)) - \[`flake8-comprehensions`] Detect overshadowed `list`/`set`/`dict`, ignore variadics and named expressions (`C417`) ([#​15955](https://redirect.github.com/astral-sh/ruff/pull/15955)) - \[`flake8-pie`] Remove following comma correctly when the unpacked dictionary is empty (`PIE800`) ([#​16008](https://redirect.github.com/astral-sh/ruff/pull/16008)) - \[`flake8-simplify`] Only trigger `SIM401` on known dictionaries ([#​15995](https://redirect.github.com/astral-sh/ruff/pull/15995)) - \[`pylint`] Do not report calls when object type and argument type mismatch, remove custom escape handling logic (`PLE1310`) ([#​15984](https://redirect.github.com/astral-sh/ruff/pull/15984)) - \[`pyupgrade`] Comments within parenthesized value ranges should not affect applicability (`UP040`) ([#​16027](https://redirect.github.com/astral-sh/ruff/pull/16027)) - \[`pyupgrade`] Don't introduce invalid syntax when upgrading old-style type aliases with parenthesized multiline values (`UP040`) ([#​16026](https://redirect.github.com/astral-sh/ruff/pull/16026)) - \[`pyupgrade`] Ensure we do not rename two type parameters to the same name (`UP049`) ([#​16038](https://redirect.github.com/astral-sh/ruff/pull/16038)) - \[`pyupgrade`] \[`ruff`] Don't apply renamings if the new name is shadowed in a scope of one of the references to the binding (`UP049`, `RUF052`) ([#​16032](https://redirect.github.com/astral-sh/ruff/pull/16032)) - \[`ruff`] Update `RUF009` to behave similar to `B008` and ignore attributes with immutable types ([#​16048](https://redirect.github.com/astral-sh/ruff/pull/16048)) ##### Server - Root exclusions in the server to project root ([#​16043](https://redirect.github.com/astral-sh/ruff/pull/16043)) ##### Bug fixes - \[`flake8-datetime`] Ignore `.replace()` calls while looking for `.astimezone` ([#​16050](https://redirect.github.com/astral-sh/ruff/pull/16050)) - \[`flake8-type-checking`] Avoid `TC004` false positive where the runtime definition is provided by `__getattr__` ([#​16052](https://redirect.github.com/astral-sh/ruff/pull/16052)) ##### Documentation - Improve `ruff-lsp` migration document ([#​16072](https://redirect.github.com/astral-sh/ruff/pull/16072)) - Undeprecate `ruff.nativeServer` ([#​16039](https://redirect.github.com/astral-sh/ruff/pull/16039)) </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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE2Ny4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> |
||
![]() |
4941975e74
|
[red-knot] Recognize ... as a singleton (#16184)
Some checks are pending
CI / cargo fuzz build (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
|
||
![]() |
d4b4f65e20
|
[pep8-naming ] Clarify preview behavior in invalid-first-argument-name-for-class-method (N804 ) (#16193)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
Adds clarification in the documentation for [invalid-first-argument-name-for-class-method (N804)](https://docs.astral.sh/ruff/rules/invalid-first-argument-name-for-class-method/#invalid-first-argument-name-for-class-method-n804) (Also fixes an unrelated typo). |
||
![]() |
96dd1b1587
|
Consider __new__ methods as special function type for enforcing class method or static method rules (#13305)
## Summary `__new__` methods are technically static methods, with `cls` as their first argument. However, Ruff currently classifies them as classmethod, which causes two issues: - It conveys incorrect information, leading to confusion. For example, in cases like ARG003, `__new__` is explicitly treated as a classmethod. - Future rules that should apply to staticmethod may not be applied correctly due to this misclassification. Motivated by this, the current PR makes the following adjustments: 1. Introduces `FunctionType::NewMethod` as an enum variant, since, for the purposes of lint rules, `__new__` sometimes behaves like a static method and other times like a class method. This is an internal change. 2. The following rule behaviors and messages are totally unchanged: - [too-many-arguments (PLR0913)](https://docs.astral.sh/ruff/rules/too-many-arguments/#too-many-arguments-plr0913) - [too-many-positional-arguments (PLR0917)](https://docs.astral.sh/ruff/rules/too-many-positional-arguments/#too-many-positional-arguments-plr0917) 3. The following rule behaviors are unchanged, but the messages have been changed for correctness to use "`__new__` method" instead of "class method": - [self-or-cls-assignment (PLW0642)](https://docs.astral.sh/ruff/rules/self-or-cls-assignment/#self-or-cls-assignment-plw0642) 4. The following rules are changed _unconditionally_ (not gated behind preview) because their current behavior is an honest bug: it just isn't true that `__new__` is a class method, and it _is_ true that `__new__` is a static method: - [unused-class-method-argument (ARG003)](https://docs.astral.sh/ruff/rules/unused-class-method-argument/#unused-class-method-argument-arg003) no longer applies to `__new__` - [unused-static-method-argument (ARG004)](https://docs.astral.sh/ruff/rules/unused-static-method-argument/#unused-static-method-argument-arg004) now applies to `__new__` 5. The only changes which differ based on `preview` are the following: - [invalid-first-argument-name-for-class-method (N804)](https://docs.astral.sh/ruff/rules/invalid-first-argument-name-for-class-method/#invalid-first-argument-name-for-class-method-n804): This is _skipped_ when `preview` is _enabled_. When `preview` is _disabled_, the rule is the same but the _message_ has been modified to say "`__new__` method" instead of "class method". - [bad-staticmethod-argument (PLW0211)](https://docs.astral.sh/ruff/rules/bad-staticmethod-argument/#bad-staticmethod-argument-plw0211): When `preview` is enabled, this now applies to `__new__`. Closes #13154 --------- Co-authored-by: dylwil3 <dylwil3@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> |
||
![]() |
f29c7b03ec
|
Warn on invalid noqa even when there are no diagnostics (#16178)
On `main` we warn the user if there is an invalid noqa comment[^1] and at least one of the following holds: - There is at least one diagnostic - A lint rule related to `noqa`s is enabled (e.g. `RUF100`) This is probably strange behavior from the point of view of the user, so we now show invalid `noqa`s even when there are no diagnostics. Closes #12831 [^1]: For the current definition of "invalid noqa comment", which may be expanded in #12811 . This PR is independent of loc. cit. in the sense that the CLI warnings should be consistent, regardless of which `noqa` comments are considered invalid. |
||
![]() |
3a0d45c85b
|
[flake8-debugger ] Also flag sys.breakpointhook and sys.__breakpointhook__ (T100 ) (#16191)
## Summary
Fixes #16189.
Only `sys.breakpointhook` is flagged by the upstream linter:
|
||
![]() |
1f17916224
|
Add doc about usedforsecurity flag for S324 (#16190)
## Summary Provides documentation about the FIPS compliant flag for Python hashlib `usedforsecurity` Fixes #16188 ## Test Plan * pre-commit hooks --------- Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com> |
||
![]() |
61fef0a64a
|
Reduce memory usage of Docstring struct (#16183)
|
||
![]() |
93aff36147
|
[red-knot] Improve handling of inherited class attributes (#16160)
Some checks are pending
CI / cargo test (linux) (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
|
||
![]() |
df45a9db64
|
[flake8-comprehensions]: Handle trailing comma in C403 fix (#16110)
## Summary Resolves [#16099 ](https://github.com/astral-sh/ruff/issues/16099) based on [#15929 ](https://github.com/astral-sh/ruff/pull/15929) ## Test Plan Added test case `s = set([x for x in range(3)],)` and updated snapshot. --------- Co-authored-by: dylwil3 <dylwil3@gmail.com> |
||
![]() |
3c69b685ee
|
[ruff ] Implicit class variable in dataclass (RUF045 ) (#14349)
## Summary Implement lint rule to flag un-annotated variable assignments in dataclass definitions. Resolves #12877. --------- Co-authored-by: dylwil3 <dylwil3@gmail.com> |
||
![]() |
171facd960
|
Sync vendored typeshed stubs (#16173)
Some checks are pending
CI / cargo clippy (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
Close and reopen this PR to trigger CI Co-authored-by: typeshedbot <> |
||
![]() |
977447f9b8
|
Sort linters alphabetically (#16168)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
## Summary Resolves #16164. Linters are now sorted by their names case-insensitively. ## Test Plan  Also unit tests. |
||
![]() |
b3e99b25bf
|
Fix missing serde feature for red_knot_python_semantic (#16169)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
## Summary Running `cargo test -p red_knot_python_semantic` failed because of a missing serde feature. This PR enables the `ruff_python_ast`'`s `serde` if the crate's `serde` feature is enabled ## Test Plan `cargo test -p red_knot_python_semantic` compiles again |
||
![]() |
dcabb948f3
|
[red-knot] add special case for float/complex (#16166)
When adjusting the existing tests, I aimed to avoid dealing with the special case in other tests if it's not necessary to do so (that is, avoid using `float` and `complex` as examples where we just need "some type"), and keep the tests for the special case mostly collected in the mdtest dedicated to that purpose. Fixes https://github.com/astral-sh/ruff/issues/14932 |
||
![]() |
219712860c
|
[refurb] Check for subclasses includes subscript expressions (FURB189) (#16155)
## Summary Added checks for subscript expressions on builtin classes as in FURB189. The object is changed to use the collections objects and the types from the subscript are kept. Resolves #16130 > Note: Added some comments in the code explaining why ## Test Plan - Added a subscript dict and list class to the test file. - Tested locally to check that the symbols are changed and the types are kept. - No modifications changed on optional `str` values. |
||
![]() |
f58a54f043
|
Move red_knot_python_semantic::PythonVersion to the ruff_python_ast crate (#16147)
## Summary This PR moves the `PythonVersion` struct from the `red_knot_python_semantic` crate to the `ruff_python_ast` crate so that it can be used more easily in the syntax error detection work. Compared to that [prototype](https://github.com/astral-sh/ruff/pull/16090/) these changes reduce us from 2 `PythonVersion` structs to 1. This does not unify any of the `PythonVersion` *enums*, but I hope to make some progress on that in a follow-up. ## Test Plan Existing tests, this should not change any external behavior. --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> |
||
![]() |
fa28dc5ccf
|
[internal] Move Linter OperatorPrecedence into ruff_python_ast crate (#16162)
## Summary This change begins to resolve #16071 by moving the `OperatorPrecedence` structs from the `ruff_python_linter` crate into `ruff_python_ast`. This PR also implements `precedence()` methods on the `Expr` and `ExprRef` enums. ## Test Plan Since this change mainly shifts existing logic, I didn't add any additional tests. Existing tests do pass. |
||
![]() |
63dd68e0ed
|
Refactor symbol lookup APIs to hide re-export implementation details (#16133)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
## Summary This PR refactors the symbol lookup APIs to better facilitate the re-export implementation. Specifically, * Add `module_type_symbol` which returns the `Symbol` that's a member of `types.ModuleType` * Rename `symbol` -> `symbol_impl`; add `symbol` which delegates to `symbol_impl` with `RequireExplicitReExport::No` * Update `global_symbol` to do `symbol_impl` -> fall back to `module_type_symbol` and default to `RequireExplicitReExport::No` * Add `imported_symbol` to do `symbol_impl` with `RequireExplicitReExport` as `Yes` if the module is in a stub file else `No` * Update `known_module_symbol` to use `imported_symbol` with a fallback to `module_type_symbol` * Update `ModuleLiteralType::member` to use `imported_symbol` with a custom fallback We could potentially also update `symbol_from_declarations` and `symbol_from_bindings` to avoid passing in the `RequireExplicitReExport` as it would be always `No` if called directly. We could add `symbol_from_declarations_impl` and `symbol_from_bindings_impl`. Looking at the `_impl` functions, I think we should move all of these symbol related logic into `symbol.rs` where `Symbol` is defined and the `_impl` could be private while we expose the public APIs at the crate level. This would also make the `RequireExplicitReExport` an implementation detail and the caller doesn't need to worry about it. |
||
![]() |
60b3ef2c98
|
[red-knot] Support re-export conventions for stub files (#16073)
This is an alternative implementation to #15848. ## Summary This PR adds support for re-export conventions for imports for stub files. **How does this work?** * Add a new flag on the `Import` and `ImportFrom` definitions to indicate whether they're being exported or not * Add a new enum to indicate whether the symbol lookup is happening within the same file or is being queried from another file (e.g., an import statement) * When a `Symbol` is being queried, we'll skip the definitions that are (a) coming from a stub file (b) external lookup and (c) check the re-export flag on the definition This implementation does not yet support `__all__` and `*` imports as both are features that needs to be implemented independently. closes: #14099 closes: #15476 ## Test Plan Add test cases, update existing ones if required. |
||
![]() |
3d0a58eb60
|
[pyupgrade ] Unwrap unary expressions correctly (UP018 ) (#15919)
## Summary Resolves #15859. The rule now adds parentheses if the original call wraps an unary expression and is: * The left-hand side of a binary expression where the operator is `**`. * The caller of a call expression. * The subscripted of a subscript expression. * The object of an attribute access. The fix will also be marked as unsafe if there are any comments in its range. ## Test Plan `cargo nextest run` and `cargo insta test`. |
||
![]() |
1db8392a5a
|
Check for backtick-quoted shortcut links in CI (#16114)
## Summary Follow-up to #16035. `check_docs_formatted.py` will now report backtick-quoted shortcut links in rule documentation. It uses a regular expression to find them. Such a link: * Starts with `[`, followed by <code>\`</code>, then a "name" sequence of at least one non-backtick non-newline character, followed by another <code>\`</code>, then ends with `]`. * Is not followed by either a `[` or a `(`. * Is not placed within a code block. If the name is a known Ruff option name, that link is not considered a violation. ## Test Plan Manual. |
||
![]() |
81e202ed52
|
Make CallBinding::callable_ty required (#16135)
## Summary The `callable_ty` is always known except in some TODO code where we can use a `TODO` type instead. ## Test Plan `cargo test` |
||
![]() |
63c67750b1
|
Replace dead link for rome tools playground (#16153)
## Summary Rome Tools Playground was renamed to Biome Playground. The link was replaced to the new website. Resolves #16143 ## Test Plan - Checked the linked is accessible from the README |
||
![]() |
0a75a1d56b
|
Replace is-macro with implementation in enums (#16144)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
|
||
![]() |
bb15c7653a
|
Use ubuntu-24 to run benchmarks (#16145) | ||
![]() |
cb8b23d609
|
[flake8-pyi] Avoid flagging custom-typevar-for-self on metaclass methods (PYI019) (#16141)
Some checks are pending
CI / cargo build (release) (push) Waiting to run
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
|
||
![]() |
be49151a3d
|
[red-knot] Remove a parameter from the symbol_by_id() query (#16138)
|
||
![]() |
7d2e40be2d
|
[pylint ] Do not offer fix for raw strings (PLE251 ) (#16132)
Some checks are pending
CI / cargo fmt (push) Waiting to run
CI / cargo build (release) (push) Waiting to run
CI / Determine changes (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
## Summary Resolves #13294, follow-up to #13882. At #13882, it was concluded that a fix should not be offered for raw strings. This change implements that. The five rules in question are now no longer always fixable. ## Test Plan `cargo nextest run` and `cargo insta test`. --------- Co-authored-by: Micha Reiser <micha@reiser.io> |
||
![]() |
f8093b65ea
|
[flake8-builtins ] Update documentation (A005 ) (#16097)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
Follow-up to https://github.com/astral-sh/ruff/pull/15951 to update * the options links in A005 to reference `lint.flake8-builtins.builtins-strict-checking` * the description of the rule to explain strict vs non-strict checking * the option documentation to point back to the rule |
||
![]() |
c31352f52b
|
[ruff ] Skip RUF001 diagnostics when visiting string type definitions (#16122)
|
||
![]() |
a9671e7008
|
ruff_db: add a vector for configuring diagnostic output (#16118)
For now, the only thing one can configure is whether color is enabled or not. This avoids needing to ask the `colored` crate whether colors have been globally enabled or disabled. And, more crucially, avoids the need to _set_ this global flag for testing diagnostic output. Doing so can have unintended consequences, as outlined in #16115. Fixes #16115 |
||
![]() |
03f08283ad
|
[red-knot] Fallback to requires-python if no python-version is specified (#16028)
## Summary Add support for the `project.requires-python` field in `pyproject.toml` files. Fall back to the resolved lower bound of `project.requires-python` if the `environment.python-version` field is `None` (or more accurately, initialize `environment.python-version with `requires-python`'s lower bound if left unspecified). ## UX design There are two options on how we can handle the fallback to `requires-python`'s lower bound: 1. Store the resolved lower bound in `environment.python-version` if that field is `None` (Implemented in this PR) 2. Store the `requires-python` constraint separately. There's no observed difference unless a user-level configuration (or any other inherited configuration is used). Let's discuss it on the given example **User configuration** ```toml [environment] python-version = "3.10" ``` **Project configuration (`pyproject.toml`)** ```toml [project] name = "test" requires-python = ">= 3.12" [tool.knot] # No environment table ``` The resolved version for 1. is 3.12 because the `requires-python` constraint precedence takes precedence over the `python-version` in the user configuration. 2. resolves to 3.10 because all `python-version` constraints take precedence before falling back to `requires-python`. Ruff implements 1. It's also the easier to implement and it does seem intuitive to me that the more local `requires-python` constraint takes precedence. ## Test plan Added CLI and unit tests. |
||
![]() |
ae1b381c06
|
[pylint ] Correct ordering of arguments in fix for if-stmt-min-max (PLR1730 ) (#16080)
Some checks are pending
CI / cargo test (linux) (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
The PR addresses the issue #16040 . --- The logic used into the rule is the following: Suppose to have an expression of the form ```python if a cmp b: c = d ``` where `a`,` b`, `c` and `d` are Python obj and `cmp` one of `<`, `>`, `<=`, `>=`. Then: - `if a=c and b=d` - if `<=` fix with `a = max(b, a)` - if `>=` fix with `a = min(b, a)` - if `>` fix with `a = min(a, b)` - if `<` fix with `a = max(a, b)` - `if a=d and b=c` - if `<=` fix with `b = min(a, b)` - if `>=` fix with `b = max(a, b)` - if `>` fix with `b = max(b, a)` - if `<` fix with `b = min(b, a)` - do nothing, i.e., we cannot fix this case. --- In total we have 8 different and possible cases. ``` | Case | Expression | Fix | |-------|------------------|---------------| | 1 | if a >= b: a = b | a = min(b, a) | | 2 | if a <= b: a = b | a = max(b, a) | | 3 | if a <= b: b = a | b = min(a, b) | | 4 | if a >= b: b = a | b = max(a, b) | | 5 | if a > b: a = b | a = min(a, b) | | 6 | if a < b: a = b | a = max(a, b) | | 7 | if a < b: b = a | b = min(b, a) | | 8 | if a > b: b = a | b = max(b, a) | ``` I added them in the tests. Please double-check that I didn't make any mistakes. It's quite easy to mix up > and <. --------- Co-authored-by: Micha Reiser <micha@reiser.io> |