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

[flake8-simplify] Stabilize implicit-else simplifications in needless-bool (SIM103) #12048

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

charliermarsh
Copy link
Member

Summary

See: #10414.

This is a good and intuitive change; we just put it in preview because it expanded scope a bit.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jun 26, 2024
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

for sure!

@charliermarsh charliermarsh merged commit cd30718 into ruff-0.5 Jun 26, 2024
16 checks passed
@charliermarsh charliermarsh deleted the charlie/sim103 branch June 26, 2024 15:24
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+157 -0 violations, +0 -0 fixes in 12 projects; 38 projects unchanged)

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

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

+ airflow/configuration.py:1315:13: SIM103 Return the condition `not value is None` directly
+ airflow/dag_processing/manager.py:1268:9: SIM103 Return the condition `not self._num_run < self._max_runs` directly
+ airflow/models/taskinstance.py:671:5: SIM103 Return the condition `not isinstance(value, (bytearray, bytes, str))` directly
+ airflow/operators/python.py:75:5: SIM103 Return the condition directly
+ airflow/providers/airbyte/triggers/airbyte.py:120:9: SIM103 Return the condition directly
+ airflow/providers/amazon/aws/hooks/s3.py:649:13: SIM103 Return the negated condition directly
+ airflow/providers/amazon/aws/sensors/athena.py:97:9: SIM103 Return the condition `not state in self.INTERMEDIATE_STATES` directly
+ airflow/providers/amazon/aws/sensors/emr.py:337:9: SIM103 Return the condition `not state in self.INTERMEDIATE_STATES` directly
+ airflow/providers/amazon/aws/sensors/opensearch_serverless.py:112:9: SIM103 Return the condition `not state in self.INTERMEDIATE_STATES` directly
+ airflow/providers/dbt/cloud/triggers/dbt.py:114:9: SIM103 Return the condition directly
+ airflow/providers/google/cloud/hooks/cloud_sql.py:946:9: SIM103 Return the condition `not (val == "False" or val is False)` directly
... 24 additional changes omitted for project

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

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

+ examples/server/app/server_auth/auth.py:40:9: SIM103 Return the condition `bool(username == "bokeh" and password == "bokeh")` directly

demisto/content (+42 -0 violations, +0 -0 fixes)

+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:763:9: SIM103 Return the negated condition directly
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:778:9: SIM103 Return the condition `self._valid(self.rcs)` directly
+ Packs/Active_Directory_Query/Integrations/Active_Directory_Query/Active_Directory_Query.py:347:5: SIM103 Return the condition `bool(entries.get('flat'))` directly
+ Packs/Base/Scripts/DBotTrainClustering/DBotTrainClustering.py:540:5: SIM103 Return the condition `1 < n_labels < n_samples` directly
+ Packs/BreachRx/Integrations/BreachRx/BreachRx_test.py:28:5: SIM103 Return the condition directly
+ Packs/BreachRx/Integrations/BreachRx/BreachRx_test.py:34:5: SIM103 Return the condition directly
+ Packs/BreachRx/Integrations/BreachRx/BreachRx_test.py:40:5: SIM103 Return the condition directly
+ Packs/BreachRx/Integrations/BreachRx/BreachRx_test.py:46:5: SIM103 Return the condition directly
+ Packs/BreachRx/Integrations/BreachRx/BreachRx_test.py:52:5: SIM103 Return the condition directly
+ Packs/BreachRx/Integrations/BreachRx/BreachRx_test.py:58:5: SIM103 Return the condition directly
+ Packs/CheckPhish/Integrations/CheckPhish/CheckPhish.py:144:5: SIM103 Return the condition `bool(res and res['status'] == DONE_STATUS)` directly
+ Packs/CommonScripts/Scripts/DisableUserWrapper/DisableUserWrapper_test.py:10:5: SIM103 Return the condition `command1.args_lst == command2.args_lst` directly
+ Packs/CommonScripts/Scripts/DomainReputation/DomainReputation.py:22:5: SIM103 Return the condition directly
... 29 additional changes omitted for project

freedomofpress/securedrop (+8 -0 violations, +0 -0 fixes)

+ admin/bootstrap.py:120:9: SIM103 Return the condition directly
+ journalist_gui/journalist_gui/SecureDropUpdater.py:23:5: SIM103 Return the condition `not pwd_flag == "NP"` directly
+ securedrop/models.py:261:9: SIM103 Return the condition directly
+ securedrop/pretty_bad_protocol/_parsers.py:1008:9: SIM103 Return the condition `bool(self.fingerprint)` directly
+ securedrop/pretty_bad_protocol/_parsers.py:1321:9: SIM103 Return the condition `not len(self.fingerprints) == 0` directly
+ securedrop/pretty_bad_protocol/_parsers.py:1425:9: SIM103 Return the condition `not len(self.fingerprints) == 0` directly
+ securedrop/pretty_bad_protocol/_parsers.py:1788:9: SIM103 Return the condition `bool(self.ok)` directly
+ securedrop/pretty_bad_protocol/_parsers.py:234:5: SIM103 Return the condition `bool(HEXADECIMAL.match(string))` directly

milvus-io/pymilvus (+5 -0 violations, +0 -0 fixes)

+ pymilvus/client/check.py:166:5: SIM103 Return the condition `not (end_date - start_date).days < 0` directly
+ pymilvus/client/check.py:20:5: SIM103 Return the negated condition directly
+ pymilvus/client/check.py:27:5: SIM103 Return the negated condition directly
+ pymilvus/orm/collection.py:1441:9: SIM103 Return the negated condition directly
+ pymilvus/orm/iterator.py:458:9: SIM103 Return the negated condition directly

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

+ mlflow/langchain/utils/chat.py:246:5: SIM103 Return the negated condition directly
+ mlflow/sklearn/utils.py:929:9: SIM103 Return the condition `len(c.__abstractmethods__)` directly
+ mlflow/tracking/_tracking_service/utils.py:27:5: SIM103 Return the condition `bool(_tracking_uri or MLFLOW_TRACKING_URI.get())` directly
+ mlflow/transformers/__init__.py:1459:5: SIM103 Return the negated condition directly
+ mlflow/utils/autologging_utils/__init__.py:275:9: SIM103 Return the condition directly
+ mlflow/utils/logging_utils.py:101:9: SIM103 Return the negated condition directly
+ mlflow/utils/search_utils.py:1242:9: SIM103 Return the negated condition directly
+ mlflow/utils/search_utils.py:1439:9: SIM103 Return the negated condition directly
+ mlflow/utils/search_utils.py:1737:9: SIM103 Return the negated condition directly
+ mlflow/utils/search_utils.py:472:9: SIM103 Return the negated condition directly
... 3 additional changes omitted for project

pypa/cibuildwheel (+1 -0 violations, +0 -0 fixes)

+ cibuildwheel/projectfiles.py:42:5: SIM103 Return the condition `not len(consts) != 1` directly

reflex-dev/reflex (+1 -0 violations, +0 -0 fixes)

+ reflex/utils/telemetry.py:96:5: SIM103 Return the condition `not should_skip_compile()` directly

scikit-build/scikit-build (+2 -0 violations, +0 -0 fixes)

+ skbuild/setuptools_wrap.py:322:5: SIM103 Return the condition directly
+ skbuild/setuptools_wrap.py:347:5: SIM103 Return the condition directly

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

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

+ corporate/lib/stripe.py:1041:9: SIM103 Return the condition directly
+ corporate/lib/stripe.py:4015:9: SIM103 Return the condition `plan_tier in implemented_plan_tiers` directly
+ corporate/lib/stripe.py:4425:9: SIM103 Return the condition `plan_tier in implemented_plan_tiers` directly
+ corporate/lib/stripe.py:4873:9: SIM103 Return the condition `plan_tier in implemented_plan_tiers` directly
+ scripts/lib/zulip_tools.py:152:5: SIM103 Return the condition directly
+ scripts/lib/zulip_tools.py:546:5: SIM103 Return the condition `bool("posix" in os.name and os.geteuid() == 0)` directly
+ zerver/actions/user_groups.py:128:9: SIM103 Return the condition `diff < realm.waiting_period_threshold` directly
+ zerver/decorator.py:1025:9: SIM103 Return the condition directly
+ zerver/lib/avatar.py:126:5: SIM103 Return the negated condition directly
+ zerver/lib/compatibility.py:157:5: SIM103 Return the negated condition directly
+ zerver/lib/compatibility.py:40:5: SIM103 Return the condition `timezone_now() > deadline` directly
+ zerver/lib/markdown/__init__.py:2070:9: SIM103 Return the condition directly
+ zerver/lib/markdown/__init__.py:2075:9: SIM103 Return the condition directly
+ zerver/lib/message.py:1416:5: SIM103 Return the negated condition directly
... 31 additional changes omitted for project

python-trio/trio (+3 -0 violations, +0 -0 fixes)

+ src/trio/_tools/gen_exports.py:61:5: SIM103 Return the condition directly
+ src/trio/_util.py:130:9: SIM103 Return the condition `value.__class__.__name__ in ("Future", "Deferred")` directly
+ src/trio/testing/_raises_group.py:236:9: SIM103 Return the negated condition directly

wntrblm/nox (+1 -0 violations, +0 -0 fixes)

+ nox/virtualenv.py:452:9: SIM103 Return the condition directly

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
SIM103 157 157 0 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -2 violations, +0 -0 fixes in 1 projects; 49 projects unchanged)

python-poetry/poetry (+0 -2 violations, +0 -0 fixes)

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

- tests/console/commands/test_run.py:113:5: F841 Local variable `tester` is assigned to but never used
- tests/console/commands/test_run.py:115:5: F841 Local variable `cmd_script_file` is assigned to but never used

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
F841 2 0 2 0 0

@charliermarsh
Copy link
Member Author

\cc @AlexWaygood - just flagging that there are a lot of ecosystem changes here.

@MichaReiser MichaReiser mentioned this pull request Jun 27, 2024
MichaReiser pushed a commit that referenced this pull request Jun 27, 2024
…dless-bool` (`SIM103`) (#12048)

## Summary

See: #10414.

This is a good and intuitive change; we just put it in preview because
it expanded scope a bit.
MichaReiser pushed a commit that referenced this pull request Jun 27, 2024
…dless-bool` (`SIM103`) (#12048)

## Summary

See: #10414.

This is a good and intuitive change; we just put it in preview because
it expanded scope a bit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants