def METHOD_NAME(args):
    root_path = os.path.abspath(args.path)
    if not os.path.exists(args.path):
        print('Nonexistent path: %s' % root_path)
        sys.exit(2)
    check_patterns = load_pattern_files(args.check_patterns)
    ignore_patterns = load_pattern_files(args.ignore_patterns)
    walk_iter = walk_all
    if args.git_only:
        walk_iter = walk_git_files
    for full_path in walk_iter(root_path):
        rel_path = full_path.replace(root_path, '').replace('\\', '/').lstrip('/')
        if not valid_file(rel_path, check_patterns, ignore_patterns):
            continue
        if args.verbose:
            print('Checking:', rel_path)
        lines = []
        with open(full_path, 'rb') as f:
            lines = f.read().split(b'\n')
            for i, line in enumerate(lines):
                try:
                    lines[i] = line.decode('utf-8')
                except UnicodeDecodeError:
                    msg_params = (rel_path, i + 1, 'Invalid UTF-8 (other errors will be ignored)')
                    error('%s:%i: %s' % msg_params)
                    if args.github_actions:
                        print('::error file=%s,line=%i::%s' % msg_params)
                    lines[i] = ''
        for linter in linters:
            try:
                linter.check(lines)
            except LinterError as e:
                error('%s: %s' % (rel_path, e))
                if args.github_actions:
                    print(e.github_actions_workflow_command(rel_path))
                if args.fix:
                    linter.fix(lines)
                    contents = '\n'.join(lines)
                    with open(full_path, 'wb') as f:
                        f.write(contents.encode('utf-8'))
    if success:
        print('All linters completed successfully')
        sys.exit(0)
    else:
        sys.exit(1)