diff --git a/codeflash/cli_cmds/cmd_init.py b/codeflash/cli_cmds/cmd_init.py index 51704d04e..d6140a6fd 100644 --- a/codeflash/cli_cmds/cmd_init.py +++ b/codeflash/cli_cmds/cmd_init.py @@ -73,7 +73,7 @@ def init_codeflash() -> None: install_github_app() - install_github_actions() + install_github_actions(override_formatter_check=True) click.echo( f"{LF}" @@ -362,9 +362,9 @@ def check_for_toml_or_setup_file() -> str | None: return cast(str, project_name) -def install_github_actions() -> None: +def install_github_actions(override_formatter_check: bool=False) -> None: try: - config, config_file_path = parse_config_file() + config, config_file_path = parse_config_file(override_formatter_check=override_formatter_check) ph("cli-github-actions-install-started") try: diff --git a/codeflash/code_utils/config_parser.py b/codeflash/code_utils/config_parser.py index a03330614..2059aa694 100644 --- a/codeflash/code_utils/config_parser.py +++ b/codeflash/code_utils/config_parser.py @@ -31,7 +31,7 @@ def find_pyproject_toml(config_file: Path | None = None) -> Path: raise ValueError(msg) -def parse_config_file(config_file_path: Path | None = None) -> tuple[dict[str, Any], Path]: +def parse_config_file(config_file_path: Path | None = None, override_formatter_check: bool=False) -> tuple[dict[str, Any], Path]: config_file_path = find_pyproject_toml(config_file_path) try: with config_file_path.open("rb") as f: @@ -85,10 +85,12 @@ def parse_config_file(config_file_path: Path | None = None) -> tuple[dict[str, A "In pyproject.toml, Codeflash only supports the 'test-framework' as pytest and unittest." ) if len(config["formatter-cmds"]) > 0: - assert config["formatter-cmds"][0] != "your-formatter $file", ( - "The formatter command is not set correctly in pyproject.toml. Please set the " - "formatter command in the 'formatter-cmds' key. More info - https://docs.codeflash.ai/configuration" - ) + #see if this is happening during Github actions setup + if not override_formatter_check: + assert config["formatter-cmds"][0] != "your-formatter $file", ( + "The formatter command is not set correctly in pyproject.toml. Please set the " + "formatter command in the 'formatter-cmds' key. More info - https://docs.codeflash.ai/configuration" + ) for key in list(config.keys()): if "-" in key: config[key.replace("-", "_")] = config[key]