def format_all_files()

in utils/code_formatter.py [0:0]


def format_all_files(check_only=False):
    failures = []
    for filename in Path("chapters").glob("**/*.mdx"):
        try:
            same = blackify(filename, check_only=check_only)
            if check_only and not same:
                failures.append(filename)
        except Exception:
            print(f"Failed to format {filename}.")
            raise

    if check_only and len(failures) > 0:
        raise ValueError(
            f"{len(failures)} files need to be formatted, run `make style`."
        )