Skip to content

Comments

[flake8-simplify] Avoid double negations (SIM103)#15562

Merged
dylwil3 merged 3 commits intoastral-sh:mainfrom
InSyncWithFoo:SIM103
Jan 18, 2025
Merged

[flake8-simplify] Avoid double negations (SIM103)#15562
dylwil3 merged 3 commits intoastral-sh:mainfrom
InSyncWithFoo:SIM103

Conversation

@InSyncWithFoo
Copy link
Contributor

Summary

Related to this comment at #6184.

Test Plan

cargo nextest run and cargo insta test.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 18, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

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

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

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

- airflow/configuration.py:1259:13: SIM103 Return the condition `not value is None` directly
+ airflow/configuration.py:1259:13: SIM103 Return the condition `value is not None` directly
- providers/src/airflow/providers/amazon/aws/sensors/athena.py:94:9: SIM103 Return the condition `not state in self.INTERMEDIATE_STATES` directly
+ providers/src/airflow/providers/amazon/aws/sensors/athena.py:94:9: SIM103 Return the condition `state not in self.INTERMEDIATE_STATES` directly
- providers/src/airflow/providers/amazon/aws/sensors/emr.py:316:9: SIM103 Return the condition `not state in self.INTERMEDIATE_STATES` directly
+ providers/src/airflow/providers/amazon/aws/sensors/emr.py:316:9: SIM103 Return the condition `state not in self.INTERMEDIATE_STATES` directly
- providers/src/airflow/providers/amazon/aws/sensors/opensearch_serverless.py:110:9: SIM103 Return the condition `not state in self.INTERMEDIATE_STATES` directly
+ providers/src/airflow/providers/amazon/aws/sensors/opensearch_serverless.py:110:9: SIM103 Return the condition `state not in self.INTERMEDIATE_STATES` directly
+ scripts/ci/pre_commit/check_integrations_list.py:113:9: SIM103 Return the condition `j not in ["Description", "Identifier"]` directly
- scripts/ci/pre_commit/check_integrations_list.py:113:9: SIM103 Return the condition `not j in ["Description", "Identifier"]` directly

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

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

- superset/commands/importers/v1/utils.py:204:5: SIM103 Return the condition `not path.suffix.lower() not in {".yaml", ".yml"}` directly
+ superset/commands/importers/v1/utils.py:204:5: SIM103 Return the condition `path.suffix.lower() in {".yaml", ".yml"}` directly

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

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

- zerver/lib/message.py:1539:5: SIM103 Return the condition `not user_profile.realm != message.get_realm()` directly
+ zerver/lib/message.py:1539:5: SIM103 Return the condition `user_profile.realm == message.get_realm()` directly
+ zerver/views/custom_profile_fields.py:82:5: SIM103 Return the condition `field_data["subtype"] != "custom"` directly
- zerver/views/custom_profile_fields.py:82:5: SIM103 Return the condition `not field_data["subtype"] == "custom"` directly

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
SIM103 16 8 8 0 0

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.

Thanks! This looks great, but let's gate it behind preview in case there's something we're missing. After doing so, you'll have to add a note to the documentation about the fix behavior under preview.

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.

Great, thank you!

@dylwil3 dylwil3 enabled auto-merge (squash) January 18, 2025 17:02
@dylwil3 dylwil3 merged commit 001e5ad into astral-sh:main Jan 18, 2025
20 checks passed
@InSyncWithFoo InSyncWithFoo deleted the SIM103 branch January 18, 2025 17:09
@dylwil3 dylwil3 added fixes Related to suggested fixes for violations preview Related to preview mode features labels Jan 18, 2025
MichaReiser added a commit that referenced this pull request Mar 13, 2025
## Summary

This PR stabilizes the fixes improvements made in
#15562 (released with ruff 0.9.3
in mid January).

There's no open issue or PR related to the changed fix behavior.

This is not a breaking change. The fix was only gated behind preview to
get some more test coverage before releasing.
MichaReiser added a commit that referenced this pull request Mar 13, 2025
## Summary

This PR stabilizes the fixes improvements made in
#15562 (released with ruff 0.9.3
in mid January).

There's no open issue or PR related to the changed fix behavior.

This is not a breaking change. The fix was only gated behind preview to
get some more test coverage before releasing.
MichaReiser added a commit that referenced this pull request Mar 13, 2025
## Summary

This PR stabilizes the fixes improvements made in
#15562 (released with ruff 0.9.3
in mid January).

There's no open issue or PR related to the changed fix behavior.

This is not a breaking change. The fix was only gated behind preview to
get some more test coverage before releasing.
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