Skip to content

Commit 822d6cc

Browse files
made some refactor changes that codeflash suggested
1 parent 395855d commit 822d6cc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

codeflash/code_utils/formatter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def get_diff_output(cmd: list[str]) -> Optional[str]:
2727
is_ruff = cmd[0] == "ruff"
2828
if e.returncode == 0 and is_ruff:
2929
return ""
30-
elif e.returncode == 1 and is_ruff:
30+
if e.returncode == 1 and is_ruff:
3131
return e.stdout.strip() or None
3232
return None
3333

@@ -61,19 +61,19 @@ def is_safe_to_format(filepath: str, max_diff_lines: int = 100) -> bool:
6161
diff_changes_stdout = get_diff_lines_output_by_black(filepath)
6262

6363
if diff_changes_stdout is None:
64-
logger.warning(f"black formatter not found, trying ruff instead...")
64+
logger.warning("black formatter not found, trying ruff instead...")
6565
diff_changes_stdout = get_diff_lines_output_by_ruff(filepath)
6666
if diff_changes_stdout is None:
67-
logger.warning(f"Both ruff, black formatters not found, skipping formatting diff check.")
67+
logger.warning("Both ruff, black formatters not found, skipping formatting diff check.")
6868
return False
6969

7070
diff_lines_count = get_diff_lines_count(diff_changes_stdout)
7171

7272
if diff_lines_count > max_diff_lines:
7373
logger.debug(f"Skipping {filepath}: {diff_lines_count} lines would change (max: {max_diff_lines})")
7474
return False
75-
else:
76-
return True
75+
76+
return True
7777

7878

7979
def format_code(formatter_cmds: list[str], path: Path, print_status: bool = True) -> str: # noqa

0 commit comments

Comments
 (0)