From 3fe5d618a06102669adad92ebab7fe529f35006a Mon Sep 17 00:00:00 2001 From: "J.I. Cruz" <58642383+jicruz96@users.noreply.github.com> Date: Wed, 24 Jul 2024 16:53:06 -0400 Subject: [PATCH] Do not log traceback if file has `skip_file` comment (#416) * fix: do not log traceback if `skip_file` comment on file * [nit] update skip_file comment --- bundled/tool/lsp_server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bundled/tool/lsp_server.py b/bundled/tool/lsp_server.py index 5dfd3fe..74bc9fb 100644 --- a/bundled/tool/lsp_server.py +++ b/bundled/tool/lsp_server.py @@ -650,9 +650,12 @@ def _run_tool_on_document( cwd=cwd, source=source, ) + except isort.exceptions.FileSkipComment: + log_warning(f"Skipping file with 'skip_file' comment: {document.path}") + return None except isort.exceptions.FileSkipped: log_warning(traceback.format_exc(chain=True)) - # Ignore file skipped. + return None except Exception: log_error(traceback.format_exc(chain=True)) raise