Skip to content

Commit d74c920

Browse files
committed
precommit fix
1 parent f6ec81d commit d74c920

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

codeflash/cli_cmds/cmd_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ def configure_pyproject_toml(setup_info: SetupInfo) -> None:
721721
)
722722
elif formatter == "don't use a formatter":
723723
formatter_cmds.append("disabled")
724-
check_formatter_installed(formatter_cmds)
724+
check_formatter_installed(formatter_cmds, exit_on_failure="no")
725725
codeflash_section["formatter-cmds"] = formatter_cmds
726726
# Add the 'codeflash' section, ensuring 'tool' section exists
727727
tool_section = pyproject_data.get("tool", tomlkit.table())

codeflash/code_utils/env_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from codeflash.code_utils.shell_utils import read_api_key_from_shell_config
1313

1414

15-
def check_formatter_installed(formatter_cmds: list[str]) -> bool:
15+
def check_formatter_installed(formatter_cmds: list[str], exit_on_failure: str = "yes") -> bool:
1616
return_code = True
1717
if formatter_cmds[0] == "disabled":
1818
return return_code
@@ -27,7 +27,8 @@ def check_formatter_installed(formatter_cmds: list[str]) -> bool:
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."
2929
)
30-
sys.exit(1)
30+
if exit_on_failure == "yes":
31+
sys.exit(1)
3132
return return_code
3233

3334

codeflash/code_utils/formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def format_code(formatter_cmds: list[str], path: Path) -> str:
3131
console.rule(f"Formatted Successfully with: {formatter_name.replace('$file', path.name)}")
3232
else:
3333
logger.error(f"Failed to format code with {' '.join(formatter_cmd_list)}")
34-
except (FileNotFoundError, NotADirectoryError) as e:
34+
except FileNotFoundError as e:
3535
from rich.panel import Panel
3636
from rich.text import Text
3737

0 commit comments

Comments
 (0)