-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Show negated condition in needless-bool
diagnostics
#10854
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
charliermarsh
force-pushed
the
charlie/negate
branch
from
April 10, 2024 04:03
e984752
to
250f136
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
SIM103 | 14 | 7 | 7 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+97 -97 violations, +0 -0 fixes in 10 projects; 34 projects unchanged)
apache/airflow (+24 -24 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ airflow/configuration.py:1309:13: SIM103 Return the condition `not value is None` directly - airflow/configuration.py:1309:13: SIM103 Return the condition `value is None` directly + airflow/dag_processing/manager.py:1248:9: SIM103 Return the condition `not self._num_run < self._max_runs` directly - airflow/dag_processing/manager.py:1248:9: SIM103 Return the condition `self._num_run < self._max_runs` directly - airflow/migrations/env.py:33:5: SIM103 Return the condition directly + airflow/migrations/env.py:33:5: SIM103 Return the negated condition directly - airflow/models/taskinstance.py:385:5: SIM103 Return the condition `isinstance(value, (bytearray, bytes, str))` directly + airflow/models/taskinstance.py:385:5: SIM103 Return the condition `not isinstance(value, (bytearray, bytes, str))` directly - airflow/providers/amazon/aws/hooks/s3.py:649:13: 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/athena.py:97:9: SIM103 Return the condition `state in self.INTERMEDIATE_STATES` directly ... 36 additional changes omitted for project
bokeh/bokeh (+1 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ examples/server/app/server_auth/auth.py:40:9: SIM103 Return the condition `bool(username == "bokeh" and password == "bokeh")` directly - examples/server/app/server_auth/auth.py:40:9: SIM103 Return the condition `username == "bokeh" and password == "bokeh"` directly
demisto/content (+25 -25 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:763:9: SIM103 Return the condition `RDL is None` directly + 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 `not not self._valid(self.rcs)` directly - Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:778:9: SIM103 Return the condition `not 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/Active_Directory_Query/Integrations/Active_Directory_Query/Active_Directory_Query.py:347:5: SIM103 Return the condition `entries.get('flat')` directly - Packs/Base/Scripts/DBotTrainClustering/DBotTrainClustering.py:540:5: SIM103 Return the condition `not 1 < n_labels < n_samples` directly + Packs/Base/Scripts/DBotTrainClustering/DBotTrainClustering.py:540:5: SIM103 Return the condition `not not 1 < n_labels < n_samples` directly + Packs/CheckPhish/Integrations/CheckPhish/CheckPhish.py:144:5: SIM103 Return the condition `bool(res and res['status'] == DONE_STATUS)` directly - Packs/CheckPhish/Integrations/CheckPhish/CheckPhish.py:144:5: SIM103 Return the condition `res and res['status'] == DONE_STATUS` directly + Packs/CimTrak-SystemIntegrityAssurance/Integrations/CimTrak/CimTrak.py:1606:5: SIM103 Return the condition `not (value.lower() == "false" or value == "0")` directly - Packs/CimTrak-SystemIntegrityAssurance/Integrations/CimTrak/CimTrak.py:1606:5: SIM103 Return the condition `value.lower() == "false" or value == "0"` directly ... 38 additional changes omitted for project
freedomofpress/securedrop (+6 -6 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ journalist_gui/journalist_gui/SecureDropUpdater.py:23:5: SIM103 Return the condition `not pwd_flag == "NP"` directly - journalist_gui/journalist_gui/SecureDropUpdater.py:23:5: SIM103 Return the condition `pwd_flag == "NP"` directly + securedrop/pretty_bad_protocol/_parsers.py:1008:9: SIM103 Return the condition `bool(self.fingerprint)` directly - securedrop/pretty_bad_protocol/_parsers.py:1008:9: SIM103 Return the condition `self.fingerprint` directly - securedrop/pretty_bad_protocol/_parsers.py:1321:9: SIM103 Return the condition `len(self.fingerprints) == 0` 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 `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:1788:9: SIM103 Return the condition `self.ok` directly ... 2 additional changes omitted for project
milvus-io/pymilvus (+5 -5 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- pymilvus/client/check.py:166:5: SIM103 Return the condition `(end_date - start_date).days < 0` directly + 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 condition `not is_legal_host(a[0]) or not is_legal_port(a[1])` directly + pymilvus/client/check.py:20:5: SIM103 Return the negated condition directly - pymilvus/client/check.py:27:5: SIM103 Return the condition directly + pymilvus/client/check.py:27:5: SIM103 Return the negated condition directly - pymilvus/orm/collection.py:1438:9: SIM103 Return the condition directly + pymilvus/orm/collection.py:1438:9: SIM103 Return the negated condition directly - pymilvus/orm/iterator.py:458:9: SIM103 Return the condition `cached_page is None or len(cached_page) < count` directly + pymilvus/orm/iterator.py:458:9: SIM103 Return the negated condition directly
mlflow/mlflow (+9 -9 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- mlflow/sklearn/utils.py:929:9: SIM103 Return the condition `not len(c.__abstractmethods__)` directly + mlflow/sklearn/utils.py:929:9: SIM103 Return the condition `not not len(c.__abstractmethods__)` directly - mlflow/tracking/_tracking_service/utils.py:25:5: SIM103 Return the condition `_tracking_uri or MLFLOW_TRACKING_URI.get()` directly + mlflow/tracking/_tracking_service/utils.py:25:5: SIM103 Return the condition `bool(_tracking_uri or MLFLOW_TRACKING_URI.get())` directly - mlflow/transformers/__init__.py:1465:5: SIM103 Return the condition directly + mlflow/transformers/__init__.py:1465:5: SIM103 Return the negated condition directly - mlflow/utils/logging_utils.py:101:9: SIM103 Return the condition directly + mlflow/utils/logging_utils.py:101:9: SIM103 Return the negated condition directly - mlflow/utils/search_utils.py:1199:9: SIM103 Return the condition directly + mlflow/utils/search_utils.py:1199:9: SIM103 Return the negated condition directly ... 8 additional changes omitted for project
pypa/cibuildwheel (+1 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- cibuildwheel/projectfiles.py:42:5: SIM103 Return the condition `len(consts) != 1` directly + cibuildwheel/projectfiles.py:42:5: SIM103 Return the condition `not len(consts) != 1` directly
reflex-dev/reflex (+1 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ reflex/utils/telemetry.py:85:5: SIM103 Return the condition `not should_skip_compile()` directly - reflex/utils/telemetry.py:85:5: SIM103 Return the condition `should_skip_compile()` directly
scikit-build/scikit-build (+1 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- skbuild/setuptools_wrap.py:348:5: SIM103 Return the condition `"sdist" in given_commands and cmake_with_sdist` directly + skbuild/setuptools_wrap.py:348:5: SIM103 Return the condition directly
zulip/zulip (+24 -24 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
- scripts/lib/zulip_tools.py:546:5: SIM103 Return the condition `"posix" in os.name and os.geteuid() == 0` directly + scripts/lib/zulip_tools.py:546:5: SIM103 Return the condition `bool("posix" in os.name and os.geteuid() == 0)` directly - zerver/decorator.py:1025:9: SIM103 Return the condition `not user_has_device(user)` directly + zerver/decorator.py:1025:9: SIM103 Return the condition directly - zerver/lib/avatar.py:144:5: SIM103 Return the condition directly + zerver/lib/avatar.py:144:5: SIM103 Return the negated condition directly - zerver/lib/compatibility.py:157:5: SIM103 Return the condition directly + zerver/lib/compatibility.py:157:5: SIM103 Return the negated condition directly - zerver/lib/message.py:1425:5: SIM103 Return the condition directly + zerver/lib/message.py:1425:5: SIM103 Return the negated condition directly + zerver/lib/message.py:1439:5: SIM103 Return the condition `not user_profile.realm != message.get_realm()` directly - zerver/lib/message.py:1439:5: SIM103 Return the condition `user_profile.realm != message.get_realm()` directly ... 36 additional changes omitted for project
Changes by rule (1 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
SIM103 | 194 | 97 | 97 | 0 | 0 |
charliermarsh
force-pushed
the
charlie/negate
branch
from
April 10, 2024 04:23
250f136
to
d501ff5
Compare
Glyphack
pushed a commit
to Glyphack/ruff
that referenced
this pull request
Apr 12, 2024
## Summary Closes astral-sh#10843.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Closes #10843.