Skip to content
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

Make unnecessary-lambda an always-unsafe fix #10668

Merged
merged 1 commit into from
Mar 30, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

See the linked issue and comment for more.

Closes #10663.

@charliermarsh charliermarsh added the bug Something isn't working label Mar 30, 2024
@charliermarsh charliermarsh requested review from AlexWaygood and removed request for AlexWaygood March 30, 2024 00:56
@charliermarsh charliermarsh enabled auto-merge (squash) March 30, 2024 00:57
@charliermarsh charliermarsh merged commit fc54f53 into main Mar 30, 2024
17 checks passed
@charliermarsh charliermarsh deleted the charlie/safe branch March 30, 2024 01:05
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could mark it as safe if we inspected the two functions and determined that they had exactly the same signatures (including the argument names). But that would be a more involved change — this looks good for now!

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+72 -6 violations, +0 -172 fixes in 8 projects; 36 projects unchanged)

DisnakeDev/disnake (+0 -0 violations, +0 -6 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ disnake/client.py:1280:52: PLW0108 Lambda may be unnecessary; consider inlining inner function
- disnake/client.py:1280:52: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ disnake/client.py:1281:53: PLW0108 Lambda may be unnecessary; consider inlining inner function
- disnake/client.py:1281:53: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ disnake/ext/commands/flag_converter.py:330:33: PLW0108 Lambda may be unnecessary; consider inlining inner function
- disnake/ext/commands/flag_converter.py:330:33: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function

apache/airflow (+0 -0 violations, +0 -16 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ airflow/providers/weaviate/hooks/weaviate.py:169:32: PLW0108 Lambda may be unnecessary; consider inlining inner function
- airflow/providers/weaviate/hooks/weaviate.py:169:32: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ airflow/providers/weaviate/hooks/weaviate.py:202:32: PLW0108 Lambda may be unnecessary; consider inlining inner function
- airflow/providers/weaviate/hooks/weaviate.py:202:32: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ airflow/providers/weaviate/hooks/weaviate.py:233:44: PLW0108 Lambda may be unnecessary; consider inlining inner function
- airflow/providers/weaviate/hooks/weaviate.py:233:44: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ airflow/providers/weaviate/hooks/weaviate.py:466:44: PLW0108 Lambda may be unnecessary; consider inlining inner function
- airflow/providers/weaviate/hooks/weaviate.py:466:44: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ airflow/providers/weaviate/hooks/weaviate.py:689:40: PLW0108 Lambda may be unnecessary; consider inlining inner function
- airflow/providers/weaviate/hooks/weaviate.py:689:40: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
... 6 additional changes omitted for project

aws/aws-sam-cli (+0 -0 violations, +0 -14 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ tests/unit/commands/local/lib/test_stack_provider.py:114:51: PLW0108 Lambda may be unnecessary; consider inlining inner function
- tests/unit/commands/local/lib/test_stack_provider.py:114:51: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ tests/unit/commands/local/lib/test_stack_provider.py:152:51: PLW0108 Lambda may be unnecessary; consider inlining inner function
- tests/unit/commands/local/lib/test_stack_provider.py:152:51: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ tests/unit/commands/local/lib/test_stack_provider.py:190:51: PLW0108 Lambda may be unnecessary; consider inlining inner function
- tests/unit/commands/local/lib/test_stack_provider.py:190:51: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ tests/unit/commands/local/lib/test_stack_provider.py:229:51: PLW0108 Lambda may be unnecessary; consider inlining inner function
- tests/unit/commands/local/lib/test_stack_provider.py:229:51: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ tests/unit/commands/local/lib/test_stack_provider.py:270:51: PLW0108 Lambda may be unnecessary; consider inlining inner function
- tests/unit/commands/local/lib/test_stack_provider.py:270:51: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
... 4 additional changes omitted for project

bokeh/bokeh (+0 -0 violations, +0 -86 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ src/bokeh/core/property/dataspec.py:201:71: PLW0108 Lambda may be unnecessary; consider inlining inner function
- src/bokeh/core/property/dataspec.py:201:71: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ src/bokeh/io/webdriver.py:219:17: PLW0108 Lambda may be unnecessary; consider inlining inner function
- src/bokeh/io/webdriver.py:219:17: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ src/bokeh/models/annotations/geometry.py:85:31: PLW0108 Lambda may be unnecessary; consider inlining inner function
- src/bokeh/models/annotations/geometry.py:85:31: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ src/bokeh/models/annotations/geometry.py:89:32: PLW0108 Lambda may be unnecessary; consider inlining inner function
- src/bokeh/models/annotations/geometry.py:89:32: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ src/bokeh/models/annotations/geometry.py:93:30: PLW0108 Lambda may be unnecessary; consider inlining inner function
- src/bokeh/models/annotations/geometry.py:93:30: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ src/bokeh/models/annotations/geometry.py:97:33: PLW0108 Lambda may be unnecessary; consider inlining inner function
- src/bokeh/models/annotations/geometry.py:97:33: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ src/bokeh/models/sources.py:203:37: PLW0108 Lambda may be unnecessary; consider inlining inner function
- src/bokeh/models/sources.py:203:37: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ src/bokeh/models/sources.py:205:48: PLW0108 Lambda may be unnecessary; consider inlining inner function
- src/bokeh/models/sources.py:205:48: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ src/bokeh/models/tools.py:1367:101: PLW0108 Lambda may be unnecessary; consider inlining inner function
... 69 additional changes omitted for project

freedomofpress/securedrop (+0 -0 violations, +0 -2 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ securedrop/pretty_bad_protocol/gnupg.py:657:26: PLW0108 Lambda may be unnecessary; consider inlining inner function
- securedrop/pretty_bad_protocol/gnupg.py:657:26: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function

fronzbot/blinkpy (+0 -0 violations, +0 -10 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ tests/test_blink_functions.py:191:13: PLW0108 Lambda may be unnecessary; consider inlining inner function
- tests/test_blink_functions.py:191:13: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ tests/test_sync_module.py:615:13: PLW0108 Lambda may be unnecessary; consider inlining inner function
- tests/test_sync_module.py:615:13: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ tests/test_util.py:135:13: PLW0108 Lambda may be unnecessary; consider inlining inner function
- tests/test_util.py:135:13: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ tests/test_util.py:149:13: PLW0108 Lambda may be unnecessary; consider inlining inner function
- tests/test_util.py:149:13: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ tests/test_util.py:166:13: PLW0108 Lambda may be unnecessary; consider inlining inner function
- tests/test_util.py:166:13: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function

ibis-project/ibis (+0 -0 violations, +0 -38 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ ibis/backends/impala/tests/test_value_exprs.py:217:9: PLW0108 Lambda may be unnecessary; consider inlining inner function
- ibis/backends/impala/tests/test_value_exprs.py:217:9: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ ibis/backends/pandas/kernels.py:293:21: PLW0108 Lambda may be unnecessary; consider inlining inner function
- ibis/backends/pandas/kernels.py:293:21: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ ibis/backends/pandas/kernels.py:296:20: PLW0108 Lambda may be unnecessary; consider inlining inner function
- ibis/backends/pandas/kernels.py:296:20: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ ibis/backends/pandas/kernels.py:298:21: PLW0108 Lambda may be unnecessary; consider inlining inner function
- ibis/backends/pandas/kernels.py:298:21: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
+ ibis/backends/pandas/kernels.py:469:22: PLW0108 Lambda may be unnecessary; consider inlining inner function
- ibis/backends/pandas/kernels.py:469:22: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
... 28 additional changes omitted for project

pandas-dev/pandas (+72 -6 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ asv_bench/benchmarks/groupby.py:954:49: PLW0108 Lambda may be unnecessary; consider inlining inner function
+ asv_bench/benchmarks/io/csv.py:340:25: PLW0108 Lambda may be unnecessary; consider inlining inner function
+ pandas/_testing/__init__.py:343:16: PLW0108 Lambda may be unnecessary; consider inlining inner function
+ pandas/_testing/__init__.py:347:16: PLW0108 Lambda may be unnecessary; consider inlining inner function
+ pandas/_testing/__init__.py:355:16: PLW0108 Lambda may be unnecessary; consider inlining inner function
+ pandas/_testing/__init__.py:359:16: PLW0108 Lambda may be unnecessary; consider inlining inner function
+ pandas/core/_numba/extensions.py:284:16: PLW0108 Lambda may be unnecessary; consider inlining inner function
+ pandas/core/arrays/arrow/array.py:167:21: PLW0108 Lambda may be unnecessary; consider inlining inner function
... 65 additional changes omitted for rule PLW0108
- pandas/tests/apply/test_series_apply.py:378:40: PT014 Duplicate of test case at index 0 in `@pytest_mark.parametrize`
- pandas/tests/groupby/aggregate/test_other.py:544:9: PT014 Duplicate of test case at index 0 in `@pytest_mark.parametrize`
- pandas/tests/groupby/aggregate/test_other.py:545:9: PT014 Duplicate of test case at index 1 in `@pytest_mark.parametrize`
- pandas/tests/groupby/aggregate/test_other.py:566:9: PT014 Duplicate of test case at index 0 in `@pytest_mark.parametrize`
- pandas/tests/groupby/aggregate/test_other.py:567:9: PT014 Duplicate of test case at index 1 in `@pytest_mark.parametrize`
- pandas/tests/series/methods/test_map.py:141:40: PT014 Duplicate of test case at index 0 in `@pytest_mark.parametrize`
... 64 additional changes omitted for project

... Truncated remaining completed project reports due to GitHub comment length restrictions

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
PLW0108 244 72 0 0 172
PT014 6 0 6 0 0

@charliermarsh
Copy link
Member Author

Yeah I thought the same thing. Kind of a bummer but oh well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unnecessary-lambda fix is unsafe even when there are no side-effects
2 participants