Skip to content

Commit bfbb733

Browse files
authored
Merge pull request #260 from codeflash-ai/formatter-output-fix
Do not output formmater check output
2 parents e1d8fe0 + 557ab89 commit bfbb733

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

codeflash/code_utils/env_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def check_formatter_installed(formatter_cmds: list[str], exit_on_failure: bool =
2222
f.flush()
2323
tmp_file = Path(f.name)
2424
try:
25-
format_code(formatter_cmds, tmp_file)
25+
format_code(formatter_cmds, tmp_file, print_status=False)
2626
except Exception:
2727
print(
2828
"⚠️ Codeflash requires a code formatter to be installed in your environment, but none was found. Please install a supported formatter, verify the formatter-cmds in your codeflash pyproject.toml config and try again."

codeflash/code_utils/formatter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pathlib import Path
1414

1515

16-
def format_code(formatter_cmds: list[str], path: Path) -> str:
16+
def format_code(formatter_cmds: list[str], path: Path, print_status: bool = True) -> str: # noqa
1717
# TODO: Only allow a particular whitelist of formatters here to prevent arbitrary code execution
1818
formatter_name = formatter_cmds[0].lower()
1919
if not path.exists():
@@ -28,7 +28,8 @@ def format_code(formatter_cmds: list[str], path: Path) -> str:
2828
try:
2929
result = subprocess.run(formatter_cmd_list, capture_output=True, check=False)
3030
if result.returncode == 0:
31-
console.rule(f"Formatted Successfully with: {formatter_name.replace('$file', path.name)}")
31+
if print_status:
32+
console.rule(f"Formatted Successfully with: {formatter_name.replace('$file', path.name)}")
3233
else:
3334
logger.error(f"Failed to format code with {' '.join(formatter_cmd_list)}")
3435
except FileNotFoundError as e:

0 commit comments

Comments
 (0)