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

Stabilize fixes for RET50{5-8} #12840

Merged
merged 2 commits into from
Aug 12, 2024
Merged

Stabilize fixes for RET50{5-8} #12840

merged 2 commits into from
Aug 12, 2024

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Aug 12, 2024

Summary

This PR stabilizes the fixes introduced in #9595

Fixes #10099

@MichaReiser MichaReiser added the fixes Related to suggested fixes for violations label Aug 12, 2024
Copy link
Contributor

github-actions bot commented Aug 12, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+0 -0 violations, +2006 -0 fixes in 4 projects; 50 projects unchanged)

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

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

- airflow/__init__.py:108:5: RET506 Unnecessary `elif` after `raise` statement
+ airflow/__init__.py:108:5: RET506 [*] Unnecessary `elif` after `raise` statement
- airflow/api/auth/backend/kerberos_auth.py:128:9: RET505 Unnecessary `elif` after `return` statement
+ airflow/api/auth/backend/kerberos_auth.py:128:9: RET505 [*] Unnecessary `elif` after `return` statement
- airflow/api/auth/backend/kerberos_auth.py:165:13: RET505 Unnecessary `elif` after `return` statement
+ airflow/api/auth/backend/kerberos_auth.py:165:13: RET505 [*] Unnecessary `elif` after `return` statement
- airflow/api_connexion/endpoints/config_endpoint.py:119:5: RET505 Unnecessary `elif` after `return` statement
+ airflow/api_connexion/endpoints/config_endpoint.py:119:5: RET505 [*] Unnecessary `elif` after `return` statement
- airflow/api_connexion/endpoints/config_endpoint.py:85:5: RET505 Unnecessary `elif` after `return` statement
+ airflow/api_connexion/endpoints/config_endpoint.py:85:5: RET505 [*] Unnecessary `elif` after `return` statement
... 921 additional changes omitted for rule RET505
- airflow/api_connexion/endpoints/forward_to_fab_endpoint.py:47:9: RET506 Unnecessary `else` after `raise` statement
+ airflow/api_connexion/endpoints/forward_to_fab_endpoint.py:47:9: RET506 [*] Unnecessary `else` after `raise` statement
- airflow/cli/commands/dag_command.py:281:5: RET506 Unnecessary `elif` after `raise` statement
+ airflow/cli/commands/dag_command.py:281:5: RET506 [*] Unnecessary `elif` after `raise` statement
- airflow/cli/commands/dag_command.py:302:5: RET506 Unnecessary `elif` after `raise` statement
+ airflow/cli/commands/dag_command.py:302:5: RET506 [*] Unnecessary `elif` after `raise` statement
... 253 additional changes omitted for rule RET506
- airflow/dag_processing/manager.py:586:21: RET508 Unnecessary `elif` after `break` statement
+ airflow/dag_processing/manager.py:586:21: RET508 [*] Unnecessary `elif` after `break` statement
- airflow/jobs/scheduler_job_runner.py:585:21: RET507 Unnecessary `else` after `continue` statement
+ airflow/jobs/scheduler_job_runner.py:585:21: RET507 [*] Unnecessary `else` after `continue` statement
- airflow/models/xcom_arg.py:655:13: RET508 Unnecessary `elif` after `break` statement
+ airflow/models/xcom_arg.py:655:13: RET508 [*] Unnecessary `elif` after `break` statement
- airflow/providers/amazon/aws/hooks/sagemaker.py:1207:21: RET508 Unnecessary `else` after `break` statement
+ airflow/providers/amazon/aws/hooks/sagemaker.py:1207:21: RET508 [*] Unnecessary `else` after `break` statement
- airflow/providers/amazon/aws/secrets/secrets_manager.py:233:13: RET507 Unnecessary `elif` after `continue` statement
+ airflow/providers/amazon/aws/secrets/secrets_manager.py:233:13: RET507 [*] Unnecessary `elif` after `continue` statement
- airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py:627:13: RET507 Unnecessary `elif` after `continue` statement
+ airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py:627:13: RET507 [*] Unnecessary `elif` after `continue` statement
- airflow/providers/snowflake/operators/snowflake.py:525:13: RET508 Unnecessary `elif` after `break` statement
+ airflow/providers/snowflake/operators/snowflake.py:525:13: RET508 [*] Unnecessary `elif` after `break` statement
... 3 additional changes omitted for rule RET508
... 1190 additional changes omitted for project

apache/superset (+0 -0 violations, +24 -0 fixes)

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

- RELEASING/verify_release.py:52:5: RET505 Unnecessary `else` after `return` statement
+ RELEASING/verify_release.py:52:5: RET505 [*] Unnecessary `else` after `return` statement
- RELEASING/verify_release.py:93:9: RET505 Unnecessary `elif` after `return` statement
+ RELEASING/verify_release.py:93:9: RET505 [*] Unnecessary `elif` after `return` statement
- scripts/build_docker.py:67:5: RET505 Unnecessary `elif` after `return` statement
+ scripts/build_docker.py:67:5: RET505 [*] Unnecessary `elif` after `return` statement
... 11 additional changes omitted for rule RET505
- superset/migrations/versions/2018-07-05_15-19_3dda56f1c4c6_migrate_num_period_compare_and_period_.py:92:5: RET506 Unnecessary `elif` after `raise` statement
+ superset/migrations/versions/2018-07-05_15-19_3dda56f1c4c6_migrate_num_period_compare_and_period_.py:92:5: RET506 [*] Unnecessary `elif` after `raise` statement
- superset/migrations/versions/2018-07-22_11-59_bebcf3fed1fe_convert_dashboard_v1_positions.py:334:13: RET507 Unnecessary `elif` after `continue` statement
+ superset/migrations/versions/2018-07-22_11-59_bebcf3fed1fe_convert_dashboard_v1_positions.py:334:13: RET507 [*] Unnecessary `elif` after `continue` statement
... 14 additional changes omitted for project

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

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

- examples/server/app/clustering/main.py:88:5: RET505 Unnecessary `elif` after `return` statement
+ examples/server/app/clustering/main.py:88:5: RET505 [*] Unnecessary `elif` after `return` statement
- release/checks.py:105:9: RET505 Unnecessary `else` after `return` statement
+ release/checks.py:105:9: RET505 [*] Unnecessary `else` after `return` statement
- release/checks.py:119:9: RET505 Unnecessary `else` after `return` statement
+ release/checks.py:119:9: RET505 [*] Unnecessary `else` after `return` statement
... 239 additional changes omitted for rule RET505
- src/bokeh/application/application.py:169:9: RET506 Unnecessary `elif` after `raise` statement
+ src/bokeh/application/application.py:169:9: RET506 [*] Unnecessary `elif` after `raise` statement
- src/bokeh/application/handlers/directory.py:154:9: RET506 Unnecessary `elif` after `raise` statement
+ src/bokeh/application/handlers/directory.py:154:9: RET506 [*] Unnecessary `elif` after `raise` statement
... 296 additional changes omitted for project

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

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

- analytics/views/stats.py:499:5: RET505 Unnecessary `elif` after `return` statement
+ analytics/views/stats.py:499:5: RET505 [*] Unnecessary `elif` after `return` statement
- corporate/lib/activity.py:111:5: RET505 Unnecessary `else` after `return` statement
+ corporate/lib/activity.py:111:5: RET505 [*] Unnecessary `else` after `return` statement
- corporate/lib/activity.py:98:5: RET505 Unnecessary `elif` after `return` statement
+ corporate/lib/activity.py:98:5: RET505 [*] Unnecessary `elif` after `return` statement
... 389 additional changes omitted for rule RET505
- corporate/lib/stripe.py:1202:13: RET506 Unnecessary `else` after `raise` statement
+ corporate/lib/stripe.py:1202:13: RET506 [*] Unnecessary `else` after `raise` statement
- corporate/lib/stripe.py:2932:21: RET506 Unnecessary `else` after `raise` statement
+ corporate/lib/stripe.py:2932:21: RET506 [*] Unnecessary `else` after `raise` statement
- corporate/lib/stripe.py:5032:9: RET506 Unnecessary `else` after `raise` statement
... 445 additional changes omitted for project

Changes by rule (4 rules affected)

code total + violation - violation + fix - fix
RET505 1582 0 0 1582 0
RET506 372 0 0 372 0
RET507 36 0 0 36 0
RET508 16 0 0 16 0

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

openai/openai-cookbook (error)

warning: Detected debug build without --no-cache.
error: Failed to parse examples/Chat_finetuning_data_prep.ipynb:6:18:25: Unparenthesized generator expression cannot be used here
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_box.ipynb:13:1:1: Expected an expression
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_confluence.ipynb:15:1:5: Simple statements must be separated by newlines or semicolons
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_gmail.ipynb:15:1:1: Expected an expression
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_jira.ipynb:15:1:1: Expected an expression
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_notion.ipynb:15:1:1: Expected an expression
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_sharepoint_doc.ipynb:28:1:5: Simple statements must be separated by newlines or semicolons
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_sharepoint_text.ipynb:28:1:5: Simple statements must be separated by newlines or semicolons
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_sql_database.ipynb:2:2:5: Simple statements must be separated by newlines or semicolons
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_middleware_azure_function.ipynb:37:1:13: Simple statements must be separated by newlines or semicolons

Formatter (preview)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

openai/openai-cookbook (error)

ruff format --preview

warning: Detected debug build without --no-cache.
error: Failed to parse examples/Chat_finetuning_data_prep.ipynb:6:18:25: Unparenthesized generator expression cannot be used here
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_box.ipynb:13:1:1: Expected an expression
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_confluence.ipynb:15:1:5: Simple statements must be separated by newlines or semicolons
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_gmail.ipynb:15:1:1: Expected an expression
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_jira.ipynb:15:1:1: Expected an expression
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_notion.ipynb:15:1:1: Expected an expression
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_sharepoint_doc.ipynb:28:1:5: Simple statements must be separated by newlines or semicolons
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_sharepoint_text.ipynb:28:1:5: Simple statements must be separated by newlines or semicolons
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_sql_database.ipynb:2:2:5: Simple statements must be separated by newlines or semicolons
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_middleware_azure_function.ipynb:37:1:13: Simple statements must be separated by newlines or semicolons

@AlexWaygood
Copy link
Member

AlexWaygood commented Aug 12, 2024

We have an open issue about a panic for the RET505 autofix:

Does it still reproduce on main?

@AlexWaygood
Copy link
Member

We have an open issue about a panic for the RET505 autofix:

* [Rule RET505 cause panic #10099](https://github.com/astral-sh/ruff/issues/10099)

Does it still reproduce on main?

Answering my own question: yes, it still repros on main. It's somewhat unusual code causing the panic, though, so maybe it's still okay to stabilise?

@MichaReiser
Copy link
Member Author

MichaReiser commented Aug 12, 2024

Yeah, the problem is with adjust_indent rather than the rule itself. I'll push a fix that fixes adjust_indent from panicking in these cases.

@MichaReiser MichaReiser merged commit d997913 into ruff-0.6 Aug 12, 2024
20 checks passed
@MichaReiser MichaReiser deleted the stabilize-ret501-fixes branch August 12, 2024 14:14
@MichaReiser MichaReiser mentioned this pull request Aug 13, 2024
@diceroll123
Copy link
Contributor

Nice work with that fix 😄👍

AlexWaygood pushed a commit that referenced this pull request Aug 14, 2024
MichaReiser added a commit that referenced this pull request Aug 14, 2024
MichaReiser added a commit that referenced this pull request Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants