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

Implement reimplemented_operator (FURB118) #9171

Merged
merged 4 commits into from
Dec 18, 2023

Conversation

siiptuo
Copy link
Contributor

@siiptuo siiptuo commented Dec 17, 2023

Summary

Implement FURB118 that recommends, for example, that lambda x, y: x + y is replaced with operator.add. Part of #1348.

Test Plan

Added test cases.

Copy link
Contributor

github-actions bot commented Dec 17, 2023

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+16 -0 violations, +0 -0 fixes in 3 projects; 38 projects unchanged)

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

ruff check --no-cache --exit-zero --preview --select ALL

+ kubernetes_tests/test_base.py:45:5: FURB118 Use `operator.contains` instead of defining a function
+ tests/api_internal/endpoints/test_rpc_api_endpoint.py:63:1: FURB118 Use `operator.eq` instead of defining a function
+ tests/decorators/test_python.py:657:5: FURB118 Use `operator.mul` instead of defining a function
+ tests/models/test_baseoperator.py:970:5: FURB118 Use `operator.add` instead of defining a function
+ tests/models/test_dagrun.py:2585:20: FURB118 [*] Use `operator.rshift` instead of defining a lambda
+ tests/serialization/test_serialized_objects.py:130:1: FURB118 Use `operator.eq` instead of defining a function

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

ruff check --no-cache --exit-zero --preview --select ALL

+ src/bokeh/core/query.py:353:9: FURB118 [*] Use `operator.contains` instead of defining a lambda
+ src/bokeh/core/query.py:354:9: FURB118 [*] Use `operator.gt` instead of defining a lambda
+ src/bokeh/core/query.py:355:9: FURB118 [*] Use `operator.lt` instead of defining a lambda
+ src/bokeh/core/query.py:356:9: FURB118 [*] Use `operator.eq` instead of defining a lambda
+ src/bokeh/core/query.py:357:9: FURB118 [*] Use `operator.ge` instead of defining a lambda
+ src/bokeh/core/query.py:358:9: FURB118 [*] Use `operator.le` instead of defining a lambda
+ src/bokeh/core/query.py:359:9: FURB118 [*] Use `operator.ne` instead of defining a lambda

zulip/zulip (+3 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview --select ALL

+ zerver/lib/management.py:158:53: FURB118 [*] Use `operator.or_` instead of defining a lambda
+ zerver/lib/mention.py:110:38: FURB118 [*] Use `operator.or_` instead of defining a lambda
+ zerver/lib/mention.py:160:38: FURB118 [*] Use `operator.or_` instead of defining a lambda

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
FURB118 16 16 0 0 0

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Dec 18, 2023
@charliermarsh
Copy link
Member

Awesome, thank you! I'll review and merge in the morning.

@charliermarsh charliermarsh added the preview Related to preview mode features label Dec 18, 2023
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Really nice work. Thanks!

@charliermarsh charliermarsh enabled auto-merge (squash) December 18, 2023 14:53
@charliermarsh charliermarsh merged commit c532089 into astral-sh:main Dec 18, 2023
16 checks passed
@siiptuo siiptuo deleted the FURB118 branch December 18, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants