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

[refurb] Implement if-expr-instead-of-or-operator (FURB110) #10687

Merged
merged 4 commits into from
Apr 6, 2024

Conversation

diceroll123
Copy link
Contributor

Summary

Add FURB110

See: #1348

Test Plan

cargo test

Copy link
Contributor

github-actions bot commented Apr 1, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+91 -0 violations, +0 -0 fixes in 5 projects; 39 projects unchanged)

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

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

+ airflow/api_connexion/endpoints/pool_endpoint.py:121:17: FURB110 Replace ternary `if` expression with `or` operator
+ airflow/cli/commands/dag_command.py:430:12: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/configuration.py:1446:13: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/amazon/aws/hooks/base_aws.py:540:16: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/amazon/aws/hooks/base_aws.py:885:20: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/amazon/aws/hooks/redshift_cluster.py:120:16: FURB110 Replace ternary `if` expression with `or` operator
+ airflow/providers/amazon/aws/hooks/redshift_cluster.py:150:16: FURB110 Replace ternary `if` expression with `or` operator
+ airflow/providers/amazon/aws/hooks/redshift_cluster.py:178:16: FURB110 Replace ternary `if` expression with `or` operator
+ airflow/providers/apache/livy/hooks/livy.py:580:22: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/apache/livy/hooks/livy.py:581:20: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/apache/spark/hooks/spark_submit.py:251:34: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/apache/spark/hooks/spark_submit.py:252:40: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py:371:17: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/cncf/kubernetes/utils/pod_manager.py:261:16: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/dingding/hooks/dingding.py:96:25: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/google/cloud/hooks/compute_ssh.py:187:25: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/google/cloud/hooks/compute_ssh.py:189:29: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/google/cloud/log/gcs_task_handler.py:128:21: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/google/cloud/transfers/gcs_to_bigquery.py:498:30: FURB110 Replace ternary `if` expression with `or` operator
+ airflow/providers/google/cloud/transfers/sftp_to_gcs.py:140:17: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/google/cloud/utils/credentials_provider.py:304:24: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/hashicorp/hooks/vault.py:216:23: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/http/hooks/http.py:114:26: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/http/hooks/http.py:115:24: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/http/hooks/http.py:349:26: FURB110 [*] Replace ternary `if` expression with `or` operator
+ airflow/providers/http/hooks/http.py:350:24: FURB110 [*] Replace ternary `if` expression with `or` operator
... 23 additional changes omitted for project

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

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

+ src/bokeh/resources.py:617:19: FURB110 [*] Replace ternary `if` expression with `or` operator
+ src/bokeh/settings.py:374:25: FURB110 [*] Replace ternary `if` expression with `or` operator
+ src/bokeh/util/compiler.py:474:12: FURB110 [*] Replace ternary `if` expression with `or` operator
+ tests/support/util/examples.py:169:22: FURB110 [*] Replace ternary `if` expression with `or` operator
+ tests/support/util/examples.py:175:26: FURB110 [*] Replace ternary `if` expression with `or` operator
+ tests/support/util/examples.py:178:26: FURB110 [*] Replace ternary `if` expression with `or` operator

rotki/rotki (+23 -0 violations, +0 -0 fixes)

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

+ rotkehlchen/accounting/history_base_entries.py:122:19: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/accounting/history_base_entries.py:173:19: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/accounting/history_base_entries.py:186:22: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/api/v1/resources.py:2396:24: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/api/v1/resources.py:2750:20: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/api/v1/resources.py:2809:41: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/api/v1/resources.py:2810:47: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/chain/arbitrum_one/modules/gmx/balances.py:155:29: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/chain/avalanche/manager.py:95:30: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/chain/bitcoin/xpub.py:53:39: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/chain/evm/accounting/interfaces.py:113:23: FURB110 [*] Replace ternary `if` expression with `or` operator
+ rotkehlchen/chain/evm/contracts.py:100:18: FURB110 [*] Replace ternary `if` expression with `or` operator
... 11 additional changes omitted for project

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

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

+ zerver/lib/events.py:697:34: FURB110 [*] Replace ternary `if` expression with `or` operator
+ zerver/webhooks/bitbucket3/view.py:269:18: FURB110 [*] Replace ternary `if` expression with `or` operator
+ zerver/webhooks/taiga/view.py:345:22: FURB110 [*] Replace ternary `if` expression with `or` operator

indico/indico (+10 -0 violations, +0 -0 fixes)

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

+ indico/modules/designer/controllers.py:203:23: FURB110 [*] Replace ternary `if` expression with `or` operator
+ indico/modules/designer/models/templates.py:148:16: FURB110 [*] Replace ternary `if` expression with `or` operator
+ indico/modules/events/abstracts/controllers/abstract_list.py:243:30: FURB110 [*] Replace ternary `if` expression with `or` operator
+ indico/modules/events/abstracts/util.py:91:56: FURB110 [*] Replace ternary `if` expression with `or` operator
+ indico/modules/events/contributions/util.py:107:63: FURB110 [*] Replace ternary `if` expression with `or` operator
+ indico/modules/events/contributions/util.py:110:63: FURB110 [*] Replace ternary `if` expression with `or` operator
+ indico/modules/events/registration/models/forms.py:404:18: FURB110 [*] Replace ternary `if` expression with `or` operator
+ indico/modules/events/tracks/models/tracks.py:118:16: FURB110 [*] Replace ternary `if` expression with `or` operator
+ indico/modules/receipts/models/templates.py:92:16: FURB110 [*] Replace ternary `if` expression with `or` operator
+ indico/web/forms/fields/principals.py:201:16: FURB110 [*] Replace ternary `if` expression with `or` operator

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
FURB110 91 91 0 0 0

@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label Apr 2, 2024
@charliermarsh charliermarsh self-assigned this Apr 6, 2024
@charliermarsh charliermarsh added the preview Related to preview mode features label Apr 6, 2024
@charliermarsh charliermarsh changed the title [refurb] - add or-oper (FURB110) [refurb] Implement if-expr-instead-of-or-operator (FURB110) Apr 6, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) April 6, 2024 16:39
@charliermarsh charliermarsh merged commit 44459f9 into astral-sh:main Apr 6, 2024
17 checks passed
Glyphack pushed a commit to Glyphack/ruff that referenced this pull request Apr 12, 2024
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.

3 participants