Skip to content

Commit a74c04a

Browse files
Merge pull request #62 from codeflash-ai/cf-576
Github Actions Setup assumes user has edited the toml file
2 parents 7942de0 + 5d883a9 commit a74c04a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

codeflash/cli_cmds/cmd_init.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def init_codeflash() -> None:
7373

7474
install_github_app()
7575

76-
install_github_actions()
76+
install_github_actions(override_formatter_check=True)
7777

7878
click.echo(
7979
f"{LF}"
@@ -362,9 +362,9 @@ def check_for_toml_or_setup_file() -> str | None:
362362
return cast(str, project_name)
363363

364364

365-
def install_github_actions() -> None:
365+
def install_github_actions(override_formatter_check: bool=False) -> None:
366366
try:
367-
config, config_file_path = parse_config_file()
367+
config, config_file_path = parse_config_file(override_formatter_check=override_formatter_check)
368368

369369
ph("cli-github-actions-install-started")
370370
try:

codeflash/code_utils/config_parser.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def find_pyproject_toml(config_file: Path | None = None) -> Path:
3131
raise ValueError(msg)
3232

3333

34-
def parse_config_file(config_file_path: Path | None = None) -> tuple[dict[str, Any], Path]:
34+
def parse_config_file(config_file_path: Path | None = None, override_formatter_check: bool=False) -> tuple[dict[str, Any], Path]:
3535
config_file_path = find_pyproject_toml(config_file_path)
3636
try:
3737
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
8585
"In pyproject.toml, Codeflash only supports the 'test-framework' as pytest and unittest."
8686
)
8787
if len(config["formatter-cmds"]) > 0:
88-
assert config["formatter-cmds"][0] != "your-formatter $file", (
89-
"The formatter command is not set correctly in pyproject.toml. Please set the "
90-
"formatter command in the 'formatter-cmds' key. More info - https://docs.codeflash.ai/configuration"
91-
)
88+
#see if this is happening during Github actions setup
89+
if not override_formatter_check:
90+
assert config["formatter-cmds"][0] != "your-formatter $file", (
91+
"The formatter command is not set correctly in pyproject.toml. Please set the "
92+
"formatter command in the 'formatter-cmds' key. More info - https://docs.codeflash.ai/configuration"
93+
)
9294
for key in list(config.keys()):
9395
if "-" in key:
9496
config[key.replace("-", "_")] = config[key]

0 commit comments

Comments
 (0)