We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 498f401 commit cd63955Copy full SHA for cd63955
codeflash/code_utils/env_utils.py
@@ -1,4 +1,5 @@
1
import os
2
+import shlex
3
import subprocess
4
from functools import lru_cache
5
from typing import Optional
@@ -8,9 +9,9 @@
8
9
10
11
def check_formatter_installed(formatter_cmds: list[str]) -> bool:
- cmd_parts = formatter_cmds[0].split(" ")
12
- if "black" in cmd_parts or "ruff" in cmd_parts:
13
- formatter = cmd_parts[0]
+ cmd_parts = shlex.split(formatter_cmds[0]," ")
+ formatter = "black" if "black" in cmd_parts else "ruff" if "ruff" in cmd_parts else None
14
+ if not formatter:
15
try:
16
subprocess.run([formatter], check=False)
17
except (FileNotFoundError, NotADirectoryError):
0 commit comments