Skip to content

[flake8-simplify] Make the fix for collapsible-if (SIM102) safe in preview#24371

Merged
dylwil3 merged 4 commits intoastral-sh:mainfrom
dylwil3:collapsible-fix-safety
Apr 2, 2026
Merged

[flake8-simplify] Make the fix for collapsible-if (SIM102) safe in preview#24371
dylwil3 merged 4 commits intoastral-sh:mainfrom
dylwil3:collapsible-fix-safety

Conversation

@dylwil3
Copy link
Copy Markdown
Collaborator

@dylwil3 dylwil3 commented Apr 2, 2026

As far as I can tell the fix for collapsible-if (SIM102) is safe. We already avoid dropping any comments (the fix is not offered in that case), and are quite careful to avoid false positives (since we allow nothing between the two if headers).

So I propose making this Safe in preview.

@dylwil3 dylwil3 added fixes Related to suggested fixes for violations preview Related to preview mode features labels Apr 2, 2026
@astral-sh-bot astral-sh-bot bot requested a review from ntBre April 2, 2026 18:19
@dylwil3 dylwil3 removed the request for review from ntBre April 2, 2026 18:30
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Apr 2, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+208 -208 violations, +0 -0 fixes in 11 projects; 45 projects unchanged)

aiven/aiven-client (+2 -2 violations, +0 -0 fixes)

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

- aiven/client/argx.py:112:13: SIM102 Use a single `if` statement instead of nested `if` statements
+ aiven/client/argx.py:112:13: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- aiven/client/cli.py:5000:13: SIM102 Use a single `if` statement instead of nested `if` statements
+ aiven/client/cli.py:5000:13: SIM102 [*] Use a single `if` statement instead of nested `if` statements

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

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

- airflow-core/src/airflow/api_fastapi/auth/tokens.py:293:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/api_fastapi/auth/tokens.py:293:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/api_fastapi/common/db/dags.py:64:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/api_fastapi/common/db/dags.py:64:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:551:5: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:551:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/api_fastapi/core_api/routes/public/xcom.py:250:5: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/xcom.py:250:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:519:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:519:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/cli/commands/config_command.py:1030:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/cli/commands/config_command.py:1030:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/cli/commands/config_command.py:905:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/cli/commands/config_command.py:905:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/models/backfill.py:240:5: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/models/backfill.py:240:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/models/serialized_dag.py:538:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/models/serialized_dag.py:538:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/providers_manager.py:1098:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/providers_manager.py:1098:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/serialization/definitions/taskgroup.py:253:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/serialization/definitions/taskgroup.py:253:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- airflow-core/src/airflow/serialization/serialized_objects.py:1418:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ airflow-core/src/airflow/serialization/serialized_objects.py:1418:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
... 180 additional changes omitted for project

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

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

- docs/scripts/extract_custom_errors.py:191:5: SIM102 Use a single `if` statement instead of nested `if` statements
+ docs/scripts/extract_custom_errors.py:191:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- superset/common/query_object.py:484:13: SIM102 Use a single `if` statement instead of nested `if` statements
+ superset/common/query_object.py:484:13: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- superset/daos/base.py:234:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ superset/daos/base.py:234:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- superset/daos/dataset.py:279:13: SIM102 Use a single `if` statement instead of nested `if` statements
+ superset/daos/dataset.py:279:13: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- superset/daos/report.py:170:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ superset/daos/report.py:170:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
... 28 additional changes omitted for project

binary-husky/gpt_academic (+3 -3 violations, +0 -0 fixes)

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

- crazy_functions/PDF_Translate_Nougat.py:82:5: SIM102 Use a single `if` statement instead of nested `if` statements
+ crazy_functions/PDF_Translate_Nougat.py:82:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- multi_language.py:166:17: SIM102 Use a single `if` statement instead of nested `if` statements
+ multi_language.py:166:17: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- shared_utils/advanced_markdown_format.py:239:13: SIM102 Use a single `if` statement instead of nested `if` statements
+ shared_utils/advanced_markdown_format.py:239:13: SIM102 [*] Use a single `if` statement instead of nested `if` statements

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

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

- docs/bokeh/source/conf.py:116:1: SIM102 Use a single `if` statement instead of nested `if` statements
+ docs/bokeh/source/conf.py:116:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- src/bokeh/core/property/dataspec.py:333:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ src/bokeh/core/property/dataspec.py:333:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- src/bokeh/core/property/visual.py:159:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ src/bokeh/core/property/visual.py:159:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- src/bokeh/core/validation/check.py:215:5: SIM102 Use a single `if` statement instead of nested `if` statements
+ src/bokeh/core/validation/check.py:215:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- src/bokeh/embed/bundle.py:237:13: SIM102 Use a single `if` statement instead of nested `if` statements
+ src/bokeh/embed/bundle.py:237:13: SIM102 [*] Use a single `if` statement instead of nested `if` statements
... 16 additional changes omitted for project

docker/docker-py (+6 -6 violations, +0 -0 fixes)

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

- docker/api/build.py:128:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ docker/api/build.py:128:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- docker/api/service.py:26:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ docker/api/service.py:26:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- docker/api/service.py:34:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ docker/api/service.py:34:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- docker/api/service.py:93:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ docker/api/service.py:93:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- docker/utils/utils.py:417:5: SIM102 Use a single `if` statement instead of nested `if` statements
+ docker/utils/utils.py:417:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
... 2 additional changes omitted for project

ing-bank/probatus (+2 -2 violations, +0 -0 fixes)

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

- probatus/sample_similarity/resemblance_model.py:160:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ probatus/sample_similarity/resemblance_model.py:160:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- probatus/utils/arrayfuncs.py:106:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ probatus/utils/arrayfuncs.py:106:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements

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

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

- src/latch_cli/snakemake/workflow.py:244:5: SIM102 Use a single `if` statement instead of nested `if` statements
+ src/latch_cli/snakemake/workflow.py:244:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements

prefecthq/prefect (+46 -46 violations, +0 -0 fixes)

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

- src/integrations/prefect-aws/prefect_aws/observers/ecs.py:645:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ src/integrations/prefect-aws/prefect_aws/observers/ecs.py:645:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:659:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:659:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- src/integrations/prefect-docker/prefect_docker/types.py:46:5: SIM102 Use a single `if` statement instead of nested `if` statements
+ src/integrations/prefect-docker/prefect_docker/types.py:46:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- src/prefect/_experimental/bundles/__init__.py:206:9: SIM102 Use a single `if` statement instead of nested `if` statements
+ src/prefect/_experimental/bundles/__init__.py:206:9: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- src/prefect/_experimental/bundles/_ignore_filter.py:207:13: SIM102 Use a single `if` statement instead of nested `if` statements
+ src/prefect/_experimental/bundles/_ignore_filter.py:207:13: SIM102 [*] Use a single `if` statement instead of nested `if` statements
- src/prefect/cli/cloud/asset.py:135:5: SIM102 Use a single `if` statement instead of nested `if` statements
... 81 additional changes omitted for project

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

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
SIM102 416 208 208 0 0

@dylwil3 dylwil3 merged commit 50ee3c2 into astral-sh:main Apr 2, 2026
43 checks passed
carljm added a commit that referenced this pull request Apr 3, 2026
* main:
  Document adding fixes in CONTRIBUTING.md (#24393)
  Sort formatter diagnostics in snapshots (#24375)
  [`pyupgrade`] Fix panic caused by handling of octals in `UP012` (#24390)
  Upgrade to nix v0.31.2 (#24385)
  Strip form feeds from indent passed to `dedent_to` (#24381)
  add recent move of the `deferred` submodule to `.git-blame-ignore-revs` (#24379)
  [ty] Fix extra_items TypedDict tests (#24367)
  [ty] Use `infer_type_expression` for validating PEP-613 type aliases (#24370)
  [`flake8-simplify`] Make the fix for `collapsible-if` (`SIM102`) safe in `preview` (#24371)
  [ty] Validate TypedDict fields when subclassing (#24338)
  [ty] pass type context to sequence literals in binary operations (#24197)
  Add release environment to notify-dependents job (#24372)
  Bump 0.15.9 (#24369)
  [ty] Move the `deferred` submodule inside `infer/builder` (#24368)
  [ty] Infer the `extra_items` keyword argument to class-based TypedDicts as an annotation expression (#24362)
  [ty] Validate type qualifiers in functional TypedDict fields and the `extra_items` keyword to functional TypedDicts (#24360)
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 preview Related to preview mode features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants