- Notifications
You must be signed in to change notification settings - Fork 22
Don't crash when isort fails #818
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
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
⚡️ Codeflash found optimizations for this PR📄 175% (1.75x) speedup for |
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.
I'm a bit confused with this, wasn't the error happening in the backend? Additionally it seems like disregard_skip is not being passed as a config to isort, which would help
@KRRT7 i have tried with |
@KRRT7 try this
|
the error happens both on frontend and backend |
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.
LGTM, can add a short test for isort for future validation
_run_formatting_test(source_code, True, optimized_function=optimization_function, expected=expected) | ||
| ||
def test_sort_imports_skip_file(): | ||
"""Test that isort skips files with # isort:skip_file.""" |
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.
This is skip file test? Whats the use of this. We should have a test where we are sorting the packages and asserting on them I think,
User description
isort fails to format if there is a
# isort:skip_file
, we are now catching it everywhere with a try-catch blockPR Type
Enhancement, Bug fix
Description
Centralize import sorting via
sort_imports
Add safe isort fallback on exceptions
Replace direct isort usage across modules
Support
float_to_top
passthroughDiagram Walkthrough
File Walkthrough
8 files
Use shared import sorter for decorator instrumentation
Replace isort with safe sorter for test code
Apply centralized sorter in pytest marker addition
Add robust sort_imports wrapper with options
Route async decorator import sorting through wrapper
Use safe sorter after adding profiler imports
Check import sorting changes via wrapper
Sort imports via formatter after AST changes
1 files
Guard isort call with suppress for replay tests