MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / check_library_function_name

Function check_library_function_name

tools/donate-cpu-server.py:1010–1065  ·  view source on GitHub ↗
(result_path: str, function_name: str, query_params: dict, nonfunc_id: str='')

Source from the content-addressed store, hash-verified

1008
1009# Lists all checkLibrary* messages regarding the given function name
1010def check_library_function_name(result_path: str, function_name: str, query_params: dict, nonfunc_id: str='') -> str:
1011 pkgs = '' if query_params.get('pkgs') == '1' else None
1012 function_name = urllib.parse.unquote_plus(function_name)
1013 if nonfunc_id:
1014 id = '[' + nonfunc_id
1015 marker = HEAD_MARKER
1016 else:
1017 if function_name.endswith('()'):
1018 id = '[checkLibrary'
1019 else:
1020 id = '[checkLibraryCheckType]'
1021 marker = INFO_MARKER
1022 output_lines_list = []
1023 for filename in glob.glob(result_path + '/*'):
1024 if not os.path.isfile(filename) or filename.endswith('.diff'):
1025 continue
1026 in_results = False
1027 package_url = None
1028 cppcheck_options = None
1029 for line in open(filename, 'rt'):
1030 if line.startswith('cppcheck: '):
1031 if OLD_VERSION not in line:
1032 # Package results seem to be too old, skip
1033 break
1034 # Current package, parse on
1035 continue
1036 if line.startswith('ftp://'):
1037 package_url = line
1038 continue
1039 if line.startswith('cppcheck-options:'):
1040 cppcheck_options = line
1041 continue
1042 if not in_results:
1043 if line.startswith(marker):
1044 in_results = True
1045 continue
1046 if line.startswith('diff:'):
1047 break
1048 if id not in line:
1049 continue
1050 if not (' ' + function_name + ' ') in line:
1051 continue
1052 if pkgs is not None and package_url is not None:
1053 pkgs += '{}\n'.format(package_url.strip())
1054 break
1055 if package_url:
1056 output_lines_list.append(package_url)
1057 package_url = None
1058 if cppcheck_options:
1059 output_lines_list.append(cppcheck_options)
1060 cppcheck_options = None
1061 output_lines_list.append(line)
1062
1063 if pkgs is not None:
1064 return pkgs
1065 return ''.join(output_lines_list)
1066
1067

Callers 1

runMethod · 0.85

Calls 3

formatMethod · 0.80
getMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected