Skip to content

Conversation

@aseembits93
Copy link
Contributor

@aseembits93 aseembits93 commented Jun 19, 2025

PR Type

Enhancement


Description

Propagate exit_on_failure flag in formatting utilities
Conditionally suppress formatter errors
Update apply_formatter_cmds and format_code signatures
Bump version to 0.14.4.post2.dev0+8ce25197


Changes walkthrough 📝

Relevant files
Enhancement
env_utils.py
Propagate exit_on_failure to format_code                                 

codeflash/code_utils/env_utils.py

  • Pass exit_on_failure to format_code call
  • Remove redundant error handling fallback
  • +1/-2     
    formatter.py
    Add exit_on_failure handling in formatter                               

    codeflash/code_utils/formatter.py

  • Add exit_on_failure parameter to functions
  • Conditionally raise on missing formatter error
  • Forward exit_on_failure through format_code and apply_formatter_cmds
  • +7/-3     
    Configuration changes
    version.py
    Update project version                                                                     

    codeflash/version.py

  • Bump __version__ to post2.dev0 build metadata
  • Expand __version_tuple__ to include metadata parts
  • +2/-2     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Return Value

    check_formatter_installed always returns True—even when formatting fails with exit_on_failure=False—so callers cannot detect missing formatters.

    def check_formatter_installed(formatter_cmds: list[str], exit_on_failure: bool = True) -> bool:  # noqa
        return_code = True
        if formatter_cmds[0] == "disabled":
            return return_code
        tmp_code = """print("hello world")"""
        with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8", suffix=".py") as f:
            f.write(tmp_code)
            f.flush()
            tmp_file = Path(f.name)
            try:
                format_code(formatter_cmds, tmp_file, print_status=False, exit_on_failure=exit_on_failure)
            except Exception:
                exit_with_message(
                    "⚠️ 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.",
                    error_on_exit=True,
                )
        return return_code

    @github-actions
    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @aseembits93 aseembits93 enabled auto-merge June 19, 2025 20:13
    @aseembits93 aseembits93 merged commit d9db2df into main Jun 19, 2025
    16 checks passed
    @aseembits93 aseembits93 deleted the cf-673 branch June 19, 2025 20:17
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    3 participants