-
-
Couldn't load subscription status.
- Fork 441
refactor: add I to ruff extend rules #1966
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
Conversation
CodSpeed Performance ReportMerging #1966 will not alter performanceComparing Summary
|
Pull Request Test Coverage Report for Build 17231813731Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors multiple parts of the codebase to both address new ruff lint rules (adding I and SIM) and improve code clarity by streamlining conditionals and import orders. Key changes include:
- Combining nested conditionals into single-line expressions where applicable.
- Reordering and consolidating import statements.
- Replacing try/except blocks with contextlib.suppress for more concise exception handling.
Reviewed Changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tortoise/query_utils.py | Combined nested condition for BackwardFKRelation handling |
| tortoise/models.py | Refactored custom primary key parsing and DB routing logic |
| tortoise/fields/data.py | Reformatted multi-line condition for DateTime/timezone handling |
| tortoise/expressions.py | Improved import order for clarity |
| tortoise/converters.py | Streamlined conditional formatting via a ternary operator |
| tortoise/contrib/test/init.py | Replaced try/except with contextlib.suppress for DB cleanup |
| tortoise/contrib/pylint/init.py | Simplified exception handling using contextlib.suppress |
| tortoise/contrib/postgres/search.py | Simplified ternary operator for Function handling in search criterion |
| tortoise/contrib/mysql/search.py | Updated imports to align with current style conventions |
| tortoise/contrib/mysql/json_functions.py | Consolidated import ordering |
| tortoise/backends/psycopg/client.py | Combined async context managers for connection and cursor |
| tortoise/backends/mysql/client.py | Unified async context management and exception suppression |
| tortoise/backends/base/schema_generator.py | Refactored default field handling with a combined condition |
| tortoise/backends/base/executor.py | Streamlined iteration and conditional checks in field projections |
| tortoise/backends/asyncpg/client.py | Condensed parameter handling for SQL queries |
| tests/test_only.py | Fixed import ordering |
| tests/backends/test_postgres.py | Replaced try/except with contextlib.suppress in test scenarios |
| tests/backends/test_mysql.py | Updated exception suppression to use contextlib.suppress |
| pyproject.toml | Added new ruff extend rules ("I", "SIM") and per-file ignores |
| examples/transactions.py | Streamlined exception suppression using contextlib.suppress |
31110b0 to
a64331b
Compare
Description
Ito ruff extend rules which was missing when migrated isort to ruffMotivation and Context
This is a addition for #1963
How Has This Been Tested?
make ci
Checklist: