def get_errors_in_all_analyzers(comparison): if not comparison.check_both_FileInfo_format(): return -1 result_analyzer_info = AnalyzerInfo(info_type="COMBINED") # FileInfo actions BEGIN for file_info_an1 in comparison.analyzer1_info.info: for error_info_an1 in file_info_an1: for binding in error_info_an1.bindings: filename_to_search = file_info_an1.file if binding.file: filename_to_search = binding.file file_info_an2 = comparison.analyzer2_info.search_by_file( filename_to_search) error_info_an2 = file_info_an2[binding.ind] error_info_to_add_an1 = copy.deepcopy(error_info_an1) error_info_to_add_an1.file = file_info_an1.file error_info_to_add_an2 = copy.deepcopy(error_info_an2) error_info_to_add_an2.file = file_info_an2.file result_analyzer_info.append( [error_info_to_add_an1, error_info_to_add_an2]) # FileInfo actions END return result_analyzer_info
from projectLib.FileInfo import FileInfo from projectLib.ErrorInfo import ErrorInfo from projectTests.ProjectConfig_test import * # REQUIRES: svace_mine test should be passed! svace_res_dir = project_source_dir + "/AnalyzerOutputs/svace_output_mine.svres" svace_info = AnalyzerInfo() svace_info.mine_info("svace", svace_res_dir, code_project_source_path, cwe_num_list, warnings_list["juliet"]) file_info = svace_info[0] file_info_to_append = FileInfo(file="proxy", errors=[ErrorInfo()]) svace_info.append(file_info_to_append) if file_info_to_append in svace_info: print("Check append: Pass") else: print("Check append: Fail") file_search = svace_info.search_by_file(filename="proxy") if file_search == file_info_to_append: print("Check search_by_file: Pass") else: print("Check search_by_file: Fail") svace_info.remove(file_info_to_append)