Skip to content

Conversation

@CodeMan62
Copy link
Contributor

Summary

closes #18272

Test Plan

i have run simple tests via cargo test and cargo insta test
also done review via cargo insta review

@github-actions
Copy link
Contributor

github-actions bot commented May 26, 2025

ruff-ecosystem results

Linter (stable)

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

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

- request_llms/oai_std_model_template.py:230:41: E712 Avoid equality comparisons to `False`; use `if not reasoning:` for false checks
+ request_llms/oai_std_model_template.py:230:41: E712 Avoid equality comparisons to `False`; use `not reasoning:` for false checks
- request_llms/oai_std_model_template.py:376:41: E712 Avoid equality comparisons to `False`; use `if not reasoning:` for false checks
+ request_llms/oai_std_model_template.py:376:41: E712 Avoid equality comparisons to `False`; use `not reasoning:` for false checks

qdrant/qdrant-client (+7 -7 violations, +0 -0 fixes)

- qdrant_client/grpc/collections_pb2.py:806:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/collections_pb2.py:806:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/collections_service_pb2.py:23:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/collections_service_pb2.py:23:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/json_with_int_pb2.py:58:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/json_with_int_pb2.py:58:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/points_pb2.py:1295:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/points_pb2.py:1295:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/points_service_pb2.py:23:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/points_service_pb2.py:23:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/qdrant_pb2.py:41:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/qdrant_pb2.py:41:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/snapshots_service_pb2.py:103:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/snapshots_service_pb2.py:103:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
E712 18 9 9 0 0

Linter (preview)

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

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

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

- request_llms/oai_std_model_template.py:230:41: E712 Avoid equality comparisons to `False`; use `if not reasoning:` for false checks
+ request_llms/oai_std_model_template.py:230:41: E712 Avoid equality comparisons to `False`; use `not reasoning:` for false checks
- request_llms/oai_std_model_template.py:376:41: E712 Avoid equality comparisons to `False`; use `if not reasoning:` for false checks
+ request_llms/oai_std_model_template.py:376:41: E712 Avoid equality comparisons to `False`; use `not reasoning:` for false checks

qdrant/qdrant-client (+7 -7 violations, +0 -0 fixes)

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

- qdrant_client/grpc/collections_pb2.py:806:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/collections_pb2.py:806:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/collections_service_pb2.py:23:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/collections_service_pb2.py:23:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/json_with_int_pb2.py:58:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/json_with_int_pb2.py:58:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/points_pb2.py:1295:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/points_pb2.py:1295:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/points_service_pb2.py:23:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/points_service_pb2.py:23:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/qdrant_pb2.py:41:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/qdrant_pb2.py:41:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks
- qdrant_client/grpc/snapshots_service_pb2.py:103:4: E712 Avoid equality comparisons to `False`; use `if not _descriptor._USE_C_DESCRIPTORS:` for false checks
+ qdrant_client/grpc/snapshots_service_pb2.py:103:4: E712 Avoid equality comparisons to `False`; use `not _descriptor._USE_C_DESCRIPTORS:` for false checks

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
E712 18 9 9 0 0

@ntBre ntBre added the diagnostics Related to reporting of diagnostics. label May 26, 2025
5 5 | if res != False:

E712.py:5:4: E712 [*] Avoid inequality comparisons to `False`; use `if res:` for truth checks
E712.py:5:4: E712 [*] Avoid inequality comparisons to `False`; use `assert res:` for truth checks
Copy link
Member

Choose a reason for hiding this comment

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

The message now is incorrect for if statements. It's also incorrect for assert because of the trailing colon.

I think the proper suggestion here is to suggest: use res for truth checks and use not res

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good to me let me update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@CodeMan62
Copy link
Contributor Author

@MichaReiser i have updated the code as you suggest is it good to go now??

Copy link
Member

@MichaReiser MichaReiser 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

@MichaReiser MichaReiser merged commit 602dd5c into astral-sh:main May 28, 2025
34 checks passed
dcreager added a commit that referenced this pull request May 28, 2025
* main:
  [ty] Support ephemeral uv virtual environments (#18335)
  Add a `ViolationMetadata::rule` method (#18234)
  Return `DiagnosticGuard` from `Checker::report_diagnostic` (#18232)
  [flake8_use_pathlib]: Replace os.symlink with Path.symlink_to (PTH211) (#18337)
  [ty] Support cancellation and retry in the server (#18273)
  [ty] Synthetic function-like callables (#18242)
  [ty] Support publishing diagnostics in the server (#18309)
  Add Autofix for ISC003 (#18256)
  [`pyupgrade`]: new rule UP050 (`useless-class-metaclass-type`) (#18334)
  [pycodestyle] Make `E712` suggestion not assume a context (#18328)
carljm added a commit to MatthewMckee4/ruff that referenced this pull request May 28, 2025
* main: (246 commits)
  [ty] Simplify signature types, use them in `CallableType` (astral-sh#18344)
  [ty] Support ephemeral uv virtual environments (astral-sh#18335)
  Add a `ViolationMetadata::rule` method (astral-sh#18234)
  Return `DiagnosticGuard` from `Checker::report_diagnostic` (astral-sh#18232)
  [flake8_use_pathlib]: Replace os.symlink with Path.symlink_to (PTH211) (astral-sh#18337)
  [ty] Support cancellation and retry in the server (astral-sh#18273)
  [ty] Synthetic function-like callables (astral-sh#18242)
  [ty] Support publishing diagnostics in the server (astral-sh#18309)
  Add Autofix for ISC003 (astral-sh#18256)
  [`pyupgrade`]: new rule UP050 (`useless-class-metaclass-type`) (astral-sh#18334)
  [pycodestyle] Make `E712` suggestion not assume a context (astral-sh#18328)
  put similar dunder-call tests next to each other (astral-sh#18343)
  [ty] Derive `PartialOrd, Ord` for `KnownInstanceType` (astral-sh#18340)
  [ty] Simplify `Type::try_bool()` (astral-sh#18342)
  [ty] Simplify `Type::normalized` slightly (astral-sh#18339)
  [ty] Move arviz off the list of selected primer projects (astral-sh#18336)
  [ty] Add --config-file CLI arg (astral-sh#18083)
  [ty] Tell the user why we inferred a certain Python version when reporting version-specific syntax errors (astral-sh#18295)
  [ty] Implement implicit inheritance from `Generic[]` for PEP-695 generic classes (astral-sh#18283)
  [ty] Add hint if async context manager is used in non-async with statement (astral-sh#18299)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics Related to reporting of diagnostics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rule E712 in pytest assertion

3 participants