Skip to content

Commit 474d385

Browse files
Merge pull request #21 from codeflash-ai/cf-495-2
CF-495 Codeflash init - check if the formatter is installed
2 parents 484859d + 895c447 commit 474d385

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

codeflash/cli_cmds/cmd_init.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,11 @@ def configure_pyproject_toml(setup_info: SetupInfo) -> None:
587587
)
588588
elif formatter == "don't use a formatter":
589589
formatter_cmds.append("disabled")
590+
if formatter in ["black", "ruff"]:
591+
try:
592+
result = subprocess.run([formatter], capture_output=True, check=False)
593+
except FileNotFoundError as e:
594+
click.echo(f"⚠️ Formatter not found: {formatter}, please ensure it is installed")
590595
codeflash_section["formatter-cmds"] = formatter_cmds
591596
# Add the 'codeflash' section, ensuring 'tool' section exists
592597
tool_section = pyproject_data.get("tool", tomlkit.table())

0 commit comments

Comments
 (0)