解析cpplint执行输出信息
(self, regex_client, cmd_output)
| 36 | """ |
| 37 | |
| 38 | def parse_result(self, regex_client, cmd_output): |
| 39 | """解析cpplint执行输出信息""" |
| 40 | errors = [] |
| 41 | for line in cmd_output: |
| 42 | reg_result = regex_client.findall(line) |
| 43 | if reg_result: |
| 44 | item = {} |
| 45 | file_path, line_num, item['error_msg'], item['error_type'], item['error_level'] = reg_result[0] |
| 46 | # 因为多线程执行的原因,读取到的stdout输出,路径前可能包含很多空字符,需要过滤掉 |
| 47 | if "\u0000" in file_path: |
| 48 | logger.warning("fix file_path(%s)." % file_path) |
| 49 | file_path = file_path.replace("\u0000", "") |
| 50 | item["file_path"] = file_path |
| 51 | line_num = int(line_num) |
| 52 | item["line_num"] = line_num if line_num > 0 else 1 |
| 53 | errors.append(item) |
| 54 | return errors |
| 55 | |
| 56 | def __format_message(self, source_dir, msg): |
| 57 | """ |
no test coverage detected