-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[pylint] Fix PLW0108 autofix introducing a syntax error when the lambda's body contains an assignment expression
#18678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lambda's body contained an assigment expression
|
…xpression parameter
pylint] Fix PLW0108 autofix introducing a syntax error when the lambda's body contained an assignment expressionpylint] Fix PLW0108 autofix introducing a syntax error when the lambda's body contains an assignment expression
ntBre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I just had one nit and an unrelated refactor we could do while we're here, but this looks good to me.
crates/ruff_linter/src/rules/pylint/rules/unnecessary_lambda.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/pylint/rules/unnecessary_lambda.rs
Outdated
Show resolved
Hide resolved
ntBre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll merge after the patch release is finished.
* main: [ty] Add builtins to completions derived from scope (#18982) [ty] Don't add incorrect subdiagnostic for unresolved reference (#18487) [ty] Simplify `KnownClass::check_call()` and `KnownFunction::check_call()` (#18981) [ty] Add micro-benchmark for #711 (#18979) [`flake8-annotations`] Make `ANN401` example error out-of-the-box (#18974) [`flake8-async`] Make `ASYNC110` example error out-of-the-box (#18975) [pandas]: Fix issue on `non pandas` dataframe `in-place` usage (PD002) (#18963) [`pylint`] Fix `PLC0415` example (#18970) [ty] Add environment variable to dump Salsa memory usage stats (#18928) [`pylint`] Fix `PLW0108` autofix introducing a syntax error when the lambda's body contains an assignment expression (#18678) Bump 0.12.1 (#18969) [`FastAPI`] Add fix safety section to `FAST002` (#18940) [ty] Add regression test for leading tab mis-alignment in diagnostic rendering (#18965) [ty] Resolve python environment in `Options::to_program_settings` (#18960) [`ruff`] Fix false positives and negatives in `RUF010` (#18690) [ty] Fix rendering of long lines that are indented with tabs [ty] Add regression test for diagnostic rendering panic [ty] Move venv and conda env discovery to `SearchPath::from_settings` (#18938)
Summary
This PR also supresses the fix if the assignment expression target shadows one of the lambda's parameters.
Fixes #18675
Test Plan
Add regression tests.