all-repos icon indicating copy to clipboard operation
all-repos copied to clipboard

Behavior when check_fix fails?

Open sloria opened this issue 6 years ago • 2 comments

Currently when an autofixer's check_fix function exits with an exception in --interactive mode, the command exits without a way to fix issues. Is there a way to fix the issues found by check_fix before proceeding?

sloria avatar Jan 20 '19 20:01 sloria

Currently there is not, wouldn't be too difficult to add though:

https://github.com/asottile/all-repos/blob/252fe6f5488df3482a68d6d41e842ea868eb4603/all_repos/autofix_lib.py#L234

probably something like:

while True:
    try:
        check_fix()
    except Exception:
        if settings.interactive:
            if not _interactive_check(use_color=autofix_settings.color):
                return
            else:
                continue
        else:
            raise

asottile avatar Jan 20 '19 20:01 asottile

Awesome. I've worked around the issue for now by just commenting out check_fix for the one repo I needed to fix, so I'm not blocked.

Maybe I'll send a PR for this if I have some extra time, but don't hold me to it =)

sloria avatar Jan 20 '19 20:01 sloria