Skip to content

Commit 5cc1823

Browse files
committed
suppress stderr in call to ruff
1 parent 5d91776 commit 5cc1823

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

jupyterlab_code_formatter/formatters.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ def format_code(self, code: str, notebook: bool, args: List[str] = [], **options
461461

462462

463463
class RuffFixFormatter(CommandLineFormatter):
464+
ruff_args = ["check", "-eq", "--fix-only", "-"]
465+
464466
@property
465467
def label(self) -> str:
466468
return f"Apply ruff Formatter"
@@ -472,7 +474,11 @@ def __init__(self):
472474
ruff_command = find_ruff_bin()
473475
except (ImportError, FileNotFoundError):
474476
ruff_command = "ruff"
475-
self.command = [ruff_command, "check", "--fix-only", "-"]
477+
self.command = [ruff_command, *self.ruff_args]
478+
479+
480+
class RuffFormatFormatter(RuffFixFormatter):
481+
ruff_args = ["format", "-q", "-"]
476482

477483

478484
SERVER_FORMATTERS = {
@@ -482,6 +488,7 @@ def __init__(self):
482488
"yapf": YapfFormatter(),
483489
"isort": IsortFormatter(),
484490
"ruff": RuffFixFormatter(),
491+
"ruffformat": RuffFormatFormatter(),
485492
"formatR": FormatRFormatter(),
486493
"styler": StylerFormatter(),
487494
"scalafmt": CommandLineFormatter(command=["scalafmt", "--stdin"]),

0 commit comments

Comments
 (0)