def METHOD_NAME(src_dir, update, clang_format, stats):
    print('processing directory: %s' % src_dir)
    for dirpath, _, filenames in os.walk(src_dir):
        if any(d in relpath(dirpath, src_dir) for d in skip_dirs):
            continue
        for file in [join(dirpath, name) for name in filenames if is_checked_by_clang(name)]:
            def report_error(msg, line=None):
                print('%s%s:%s %s%s' % (TERM_YELLOW, file, '%d:' % line if line else '', msg, TERM_EMPTY))
                stats.errors += 1
            with open(file, 'r') as f:
                original = f.readlines()
            formatted = subprocess.check_output([clang_format, '-style=file', file])
            if update:
                with open(file, 'wb') as f:
                    f.write(formatted)
            stats.files += 1
            stats.lines += len(original)
            for lineno, line in enumerate(original):
                lineno += 1
                if '\t' in line:
                    report_error('TAB character', lineno)
                if '\r' in line:
                    report_error('CR character', lineno)
                if line.endswith(' \n') or line.endswith('\t\n'):
                    report_error('trailing whitespace', lineno)
                if not line.endswith('\n'):
                    report_error('line ends without NEW LINE character', lineno)
                if not line.strip():
                    stats.empty_lines += 1
            diff = list(unified_diff(original, formatted.decode('utf-8').splitlines(True)))
            if diff:
                report_error('format error')
                for diffline in diff:
                    print(diffline, end='')
            # if not CheckLicenser.check(file):
            #     report_error('incorrect license')