Skip to content

Conversation

VascoSch92
Copy link
Contributor

The PR add the fix safety section for rule SIM117 (#15584 ), and enable a fix in preview mode.

@dylwil3 Is the first time I'm exposed to the preview mode. So please let me know what should I do/fix. I hope I got what you wanted to say.

@VascoSch92 VascoSch92 mentioned this pull request May 19, 2025
71 tasks
Copy link
Contributor

github-actions bot commented May 19, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

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

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

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

- airflow-core/src/airflow/cli/commands/rotate_fernet_key_command.py:36:5: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/src/airflow/cli/commands/rotate_fernet_key_command.py:36:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/always/test_secrets_local_filesystem.py:380:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/always/test_secrets_local_filesystem.py:380:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/always/test_secrets_local_filesystem.py:392:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/always/test_secrets_local_filesystem.py:392:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/always/test_secrets_local_filesystem.py:406:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/always/test_secrets_local_filesystem.py:406:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/api/common/test_mark_tasks.py:38:5: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/api/common/test_mark_tasks.py:38:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/api/common/test_mark_tasks.py:63:5: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/api/common/test_mark_tasks.py:63:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/api/common/test_mark_tasks.py:93:5: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/api/common/test_mark_tasks.py:93:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:1669:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:1669:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/cli/commands/test_dag_command.py:378:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/cli/commands/test_dag_command.py:378:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/core/test_configuration.py:1161:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/core/test_configuration.py:1161:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/core/test_configuration.py:1206:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/core/test_configuration.py:1206:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/core/test_configuration.py:1579:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/core/test_configuration.py:1579:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/core/test_configuration.py:1775:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/core/test_configuration.py:1775:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/core/test_configuration.py:488:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/core/test_configuration.py:488:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/core/test_configuration.py:493:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/core/test_configuration.py:493:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/core/test_configuration.py:695:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/core/test_configuration.py:695:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/core/test_logging_config.py:198:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/core/test_logging_config.py:198:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/core/test_settings.py:223:5: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ airflow-core/tests/unit/core/test_settings.py:223:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- airflow-core/tests/unit/core/test_sqlalchemy_config.py:111:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
... 233 additional changes omitted for project

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

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

- superset/db_engine_specs/gsheets.py:376:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ superset/db_engine_specs/gsheets.py:376:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- superset/models/core.py:567:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ superset/models/core.py:567:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- superset/sql_lab.py:706:5: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ superset/sql_lab.py:706:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- tests/conftest.py:72:5: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ tests/conftest.py:72:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- tests/integration_tests/dashboards/commands_tests.py:776:13: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ tests/integration_tests/dashboards/commands_tests.py:776:13: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
... 30 additional changes omitted for project

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

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

- src/bokeh/application/handlers/code.py:157:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ src/bokeh/application/handlers/code.py:157:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- tests/unit/bokeh/command/subcommands/test_json__subcommands.py:92:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ tests/unit/bokeh/command/subcommands/test_json__subcommands.py:92:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- tests/unit/bokeh/command/subcommands/test_serve.py:584:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ tests/unit/bokeh/command/subcommands/test_serve.py:584:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- tests/unit/bokeh/command/subcommands/test_serve.py:612:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ tests/unit/bokeh/command/subcommands/test_serve.py:612:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
- tests/unit/bokeh/command/subcommands/test_serve.py:629:9: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ tests/unit/bokeh/command/subcommands/test_serve.py:629:9: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
... 34 additional changes omitted for project

latchbio/latch (+0 -0 violations, +2 -0 fixes)

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

- src/latch_cli/services/login.py:38:5: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
+ src/latch_cli/services/login.py:38:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
SIM117 356 0 0 356 0

@ntBre ntBre added rule Implementing or modifying a lint rule preview Related to preview mode features labels May 19, 2025
Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

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

Thank you! This is great - could you add a test as well? You should be able to just copy the same test fixture path here:

#[test_case(Rule::IfElseBlockInsteadOfIfExp, Path::new("SIM108.py"))]

@VascoSch92 VascoSch92 requested a review from dylwil3 May 20, 2025 06:10
@VascoSch92
Copy link
Contributor Author

@dylwil3 thanks for the guidance ;-)

Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

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

Thank you!!

@dylwil3 dylwil3 merged commit 4f8a005 into astral-sh:main May 20, 2025
34 checks passed
dylwil3 added a commit that referenced this pull request Sep 5, 2025
…` (`SIM117`) (#20270)

Introduced in #18208. Removed gating, updated tests and docs.
ntBre pushed a commit that referenced this pull request Sep 8, 2025
…` (`SIM117`) (#20270)

Introduced in #18208. Removed gating, updated tests and docs.
ntBre pushed a commit that referenced this pull request Sep 10, 2025
…` (`SIM117`) (#20270)

Introduced in #18208. Removed gating, updated tests and docs.
ntBre pushed a commit that referenced this pull request Sep 10, 2025
…` (`SIM117`) (#20270)

Introduced in #18208. Removed gating, updated tests and docs.
ntBre pushed a commit that referenced this pull request Sep 10, 2025
…` (`SIM117`) (#20270)

Introduced in #18208. Removed gating, updated tests and docs.
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