def CMDlint(parser, args):
    'Runs cpplint on the current changelist.'
    parser.add_option('--filter', action='append', metavar='-x,+y', help="Comma-separated list of cpplint's category-filters")
    auth.add_auth_options(parser)
    (options, args) = parser.parse_args(args)
    auth_config = auth.extract_auth_config_from_options(options)
    try:
        import cpplint
        import cpplint_chromium
    except ImportError:
        print('Your depot_tools is missing cpplint.py and/or cpplint_chromium.py.')
        return 1
    previous_cwd = os.getcwd()
    os.chdir(settings.GetRoot())
    try:
        cl = Changelist(auth_config=auth_config)
        change = cl.GetChange(cl.GetCommonAncestorWithUpstream(), None)
        files = [f.LocalPath() for f in change.AffectedFiles()]
        if (not files):
            print('Cannot lint an empty CL')
            return 1
        command = (args + files)
        if options.filter:
            command = ([('--filter=' + ','.join(options.filter))] + command)
        filenames = cpplint.ParseArguments(command)
        white_regex = re.compile(settings.GetLintRegex())
        black_regex = re.compile(settings.GetLintIgnoreRegex())
        extra_check_functions = [cpplint_chromium.CheckPointerDeclarationWhitespace]
        for filename in filenames:
            if white_regex.match(filename):
                if black_regex.match(filename):
                    print(('Ignoring file %s' % filename))
                else:
                    cpplint.ProcessFile(filename, cpplint._cpplint_state.verbose_level, extra_check_functions)
            else:
                print(('Skipping file %s' % filename))
    finally:
        os.chdir(previous_cwd)
    print(('Total errors found: %d\n' % cpplint._cpplint_state.error_count))
    if (cpplint._cpplint_state.error_count != 0):
        return 1
    return 0
Runs cpplint on the current changelist.
def CMDlint(parser, args):
    
    parser.add_option('--filter', action='append', metavar='-x,+y', help="Comma-separated list of cpplint's category-filters")
    auth.add_auth_options(parser)
    (options, args) = parser.parse_args(args)
    auth_config = auth.extract_auth_config_from_options(options)
    try:
        import cpplint
        import cpplint_chromium
    except ImportError:
        print('Your depot_tools is missing cpplint.py and/or cpplint_chromium.py.')
        return 1
    previous_cwd = os.getcwd()
    os.chdir(settings.GetRoot())
    try:
        cl = Changelist(auth_config=auth_config)
        change = cl.GetChange(cl.GetCommonAncestorWithUpstream(), None)
        files = [f.LocalPath() for f in change.AffectedFiles()]
        if (not files):
            print('Cannot lint an empty CL')
            return 1
        command = (args + files)
        if options.filter:
            command = ([('--filter=' + ','.join(options.filter))] + command)
        filenames = cpplint.ParseArguments(command)
        white_regex = re.compile(settings.GetLintRegex())
        black_regex = re.compile(settings.GetLintIgnoreRegex())
        extra_check_functions = [cpplint_chromium.CheckPointerDeclarationWhitespace]
        for filename in filenames:
            if white_regex.match(filename):
                if black_regex.match(filename):
                    print(('Ignoring file %s' % filename))
                else:
                    cpplint.ProcessFile(filename, cpplint._cpplint_state.verbose_level, extra_check_functions)
            else:
                print(('Skipping file %s' % filename))
    finally:
        os.chdir(previous_cwd)
    print(('Total errors found: %d\n' % cpplint._cpplint_state.error_count))
    if (cpplint._cpplint_state.error_count != 0):
        return 1
    return 0