#!/usr/bin/env python import argparse import logging import os import subprocess import sys def parse_args(): arg_parser = argparse.ArgumentParser() arg_parser.add_argument( '-c', '--clang-format', default='clang-format-6.0', help='Path to clang-format executable') arg_parser.add_argument( '-f', '--fix', action='store_true', help='Automatically fix all files with formatting errors') return arg_parser.parse_args(sys.argv[1:]) def parse_clang_xml(xml): for line in xml.splitlines(): if line.startswith('