def check_files(files, fix_in_place, verbose):
    num_failed_files = 0
    for file in files:
        output = shell_utils.run_shell_command(('clang-format -style=file -fallback-style=none ' + file))
        formatted_file = tempfile.NamedTemporaryFile()
        formatted_file.write(output)
        formatted_file.seek(0)
        file_changed = (not filecmp.cmp(formatted_file.name, file))
        if file_changed:
            num_failed_files += 1
            print(((((Colors.RED + Symbols.FAIL) + Colors.END) + ' ') + str(file)))
            if verbose:
                original_file = open(file, 'r')
                new_file = open(formatted_file.name, 'r')
                diff = difflib.unified_diff(original_file.readlines(), new_file.readlines())
                print(Colors.CYAN)
                for line in diff:
                    sys.stdout.write(line)
                print(Colors.END)
            if fix_in_place:
                print(((Colors.YELLOW + 'WARNING: Fixing in place. Original file will be changed.') + Colors.END))
                shutil.move(formatted_file.name, file)
        else:
            print(((((Colors.GREEN + Symbols.PASS) + Colors.END) + ' ') + str(file)))
        try:
            formatted_file.close()
        except FileNotFoundError as _:
            pass
    return num_failed_files
def check_files(files, fix_in_place, verbose):
    num_failed_files = 0
    for file in files:
        output = shell_utils.run_shell_command(('clang-format -style=file -fallback-style=none ' + file))
        formatted_file = tempfile.NamedTemporaryFile()
        formatted_file.write(output)
        formatted_file.seek(0)
        file_changed = (not filecmp.cmp(formatted_file.name, file))
        if file_changed:
            num_failed_files += 1
            print(((((Colors.RED + Symbols.FAIL) + Colors.END) + ' ') + str(file)))
            if verbose:
                original_file = open(file, 'r')
                new_file = open(formatted_file.name, 'r')
                diff = difflib.unified_diff(original_file.readlines(), new_file.readlines())
                print(Colors.CYAN)
                for line in diff:
                    sys.stdout.write(line)
                print(Colors.END)
            if fix_in_place:
                print(((Colors.YELLOW + 'WARNING: Fixing in place. Original file will be changed.') + Colors.END))
                shutil.move(formatted_file.name, file)
        else:
            print(((((Colors.GREEN + Symbols.PASS) + Colors.END) + ' ') + str(file)))
        try:
            formatted_file.close()
        except FileNotFoundError as _:
            pass
    return num_failed_files