예제 #1
0
def construct_result_handler(args,
                             buildaction,
                             run_id,
                             report_output,
                             severity_map,
                             skiplist_handler,
                             lock,
                             store_to_db=False):
    """
    Construct a result handler.
    """

    if store_to_db:
        # Create a result handler which stores the results into a database.
        if buildaction.analyzer_type == CLANG_SA:
            csa_res_handler = result_handler_clangsa.ClangSAPlistToDB(
                buildaction, report_output, run_id)

            csa_res_handler.severity_map = severity_map
            csa_res_handler.skiplist_handler = skiplist_handler
            return csa_res_handler

        elif buildaction.analyzer_type == CLANG_TIDY:
            ct_res_handler = result_handler_clang_tidy.ClangTidyPlistToDB(
                buildaction, report_output, run_id)

            ct_res_handler.severity_map = severity_map
            ct_res_handler.skiplist_handler = skiplist_handler
            return ct_res_handler

        else:
            LOG.error('Not supported analyzer type')
            return None
    else:
        if buildaction.analyzer_type == CLANG_SA:
            csa_res_handler = result_handler_clangsa.ClangSAPlistToStdout(
                buildaction, report_output, lock)

            csa_res_handler.print_steps = args.print_steps
            csa_res_handler.skiplist_handler = skiplist_handler
            return csa_res_handler

        elif buildaction.analyzer_type == CLANG_TIDY:
            ct_res_handler = result_handler_clang_tidy.ClangTidyPlistToStdout(
                buildaction, report_output, lock)

            ct_res_handler.severity_map = severity_map
            ct_res_handler.skiplist_handler = skiplist_handler
            return ct_res_handler
        else:
            LOG.error('Not supported analyzer type')
            return None
예제 #2
0
def construct_result_handler(args,
                             buildaction,
                             run_id,
                             report_output,
                             severity_map,
                             skiplist_handler,
                             lock,
                             store_to_db=False):
    """
    Construct a result handler.
    """
    assert buildaction.analyzer_type in supported_analyzers, \
        'Analyzer types should have been checked already.'

    if store_to_db:
        # Create a result handler which stores the results into a database.
        if buildaction.analyzer_type == CLANG_SA:
            res_handler = result_handler_plist_to_db.PlistToDB(
                buildaction, report_output, run_id)

        elif buildaction.analyzer_type == CLANG_TIDY:
            res_handler = result_handler_clang_tidy.ClangTidyPlistToDB(
                buildaction, report_output, run_id)

    else:
        if buildaction.analyzer_type == CLANG_SA:
            res_handler = result_handler_plist_to_stdout.PlistToStdout(
                buildaction, report_output, lock)
            res_handler.print_steps = args.print_steps

        elif buildaction.analyzer_type == CLANG_TIDY:
            res_handler = result_handler_clang_tidy.ClangTidyPlistToStdout(
                buildaction, report_output, lock)

    res_handler.severity_map = severity_map
    res_handler.skiplist_handler = skiplist_handler
    return res_handler