You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We put isort:skip_file in some of our code-gen files. When we run isort across the entire repo, it works.
Recently, we've integrated isort into something like a pre-commit hook (arc diff). Since we were combining it with Black, we pipe things through stdin/stdout but we are hitting errors with isort:skip_file.
Traceback (most recent call last):
File "/Users/edpage/.cache/venv/lib/python3.9/site-packages/isort/api.py", line 185, in sort_stream
changed = core.process(
File "/Users/edpage/.cache/venv/lib/python3.9/site-packages/isort/core.py", line 151, in process
raise FileSkipComment("Passed in content")
isort.exceptions.FileSkipComment: Passed in content contains an file skip comment and was skipped.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/edpage/.cache/venv/bin/isort", line 8, in <module>
sys.exit(main())
File "/Users/edpage/.cache/venv/lib/python3.9/site-packages/isort/main.py", line 1085, in main
api.sort_stream(
File "/Users/edpage/.cache/venv/lib/python3.9/site-packages/isort/api.py", line 192, in sort_stream
raise FileSkipComment(content_source)
isort.exceptions.FileSkipComment: Passed in content contains an file skip comment and was skipped.
When processing files, isort catches this and records it as a skip. When processing streams, nothing catches the exception and continues to stream out the content, as I would expect.
There are various changes we can make to our hook but they seem like we'd be re-implementing logic in isort and that addressing this in isort in some way would be more correct.
The text was updated successfully, but these errors were encountered:
I agree this is not ideal! I've done my best to address this here: #1706. When streaming (from the commandline utility), if isort encounters a skip file comment, instead of raising an exception - it will now stream the remainder of the file without modification.
isort version 5.8.0
We put
isort:skip_file
in some of our code-gen files. When we runisort
across the entire repo, it works.Recently, we've integrated
isort
into something like a pre-commit hook (arc diff
). Since we were combining it with Black, we pipe things through stdin/stdout but we are hitting errors withisort:skip_file
.When processing files,
isort
catches this and records it as a skip. When processing streams, nothing catches the exception and continues to stream out the content, as I would expect.There are various changes we can make to our hook but they seem like we'd be re-implementing logic in
isort
and that addressing this inisort
in some way would be more correct.The text was updated successfully, but these errors were encountered: