Skip to content

Commit afb7b04

Browse files
authored
Merge branch 'main' into git-commit-no-bot
2 parents 7a5c941 + ad9666c commit afb7b04

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

codeflash/code_utils/formatter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ def is_diff_line(line: str) -> bool:
9797

9898

9999
def format_generated_code(generated_test_source: str, formatter_cmds: list[str]) -> str:
100+
formatter_name = formatter_cmds[0].lower() if formatter_cmds else "disabled"
101+
if formatter_name == "disabled": # nothing to do if no formatter provided
102+
return re.sub(r"\n{2,}", "\n\n", generated_test_source)
100103
with tempfile.TemporaryDirectory() as test_dir_str:
101104
# try running formatter, if nothing changes (could be due to formatting failing or no actual formatting needed) return code with 2 or more newlines substituted with 2 newlines
102105
original_temp = Path(test_dir_str) / "original_temp.py"

0 commit comments

Comments
 (0)