Exemple #1
0
def lint_tools_on_path(ctx, paths, lint_args, **kwds):
    assert_tools = kwds.get("assert_tools", True)
    recursive = kwds.get("recursive", False)
    exit = 0
    valid_tools = 0
    for path in paths:
        for (tool_path, tool_xml) in yield_tool_xmls(ctx, path, recursive):
            info("Linting tool %s" % tool_path)
            if not lint_xml(tool_xml, **lint_args):
                error("Failed linting")
                exit = 1
            else:
                valid_tools += 1
    if exit == 0 and valid_tools == 0 and assert_tools:
        exit = 2
    return exit
Exemple #2
0
def lint_tools_on_path(ctx, paths, lint_args, **kwds):
    assert_tools = kwds.get("assert_tools", True)
    recursive = kwds.get("recursive", False)
    valid_tools = 0
    exit_codes = []
    for path in paths:
        for (tool_path, tool_xml) in yield_tool_xmls(ctx, path, recursive):
            if handle_tool_load_error(tool_path, tool_xml):
                exit_codes.append(EXIT_CODE_GENERIC_FAILURE)
                continue
            info("Linting tool %s" % tool_path)
            if not lint_xml(tool_xml, **lint_args):
                error("Failed linting")
                exit_codes.append(EXIT_CODE_GENERIC_FAILURE)
            else:
                valid_tools += 1
                exit_codes.append(EXIT_CODE_OK)
    return coalesce_return_codes(exit_codes, assert_at_least_one=assert_tools)