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

Function clientsReport

tools/donate-cpu-server.py:1068–1138  ·  view source on GitHub ↗
(results_path: str)

Source from the content-addressed store, hash-verified

1066
1067
1068def clientsReport(results_path: str):
1069 html = '<!DOCTYPE html>\n'
1070 html += '<html><head><title>Clients report</title></head><body>\n'
1071 html += '<h1>Clients report</h1>\n'
1072 current_year = datetime.date.today().year
1073 # TODO: use full profiles?
1074 # TODO: add jobs
1075 platforms = {}
1076 py_versions = {}
1077 client_versions = {}
1078 compilers = {}
1079 for filename in sorted(glob.glob(os.path.expanduser(results_path + '/*'))):
1080 if not os.path.isfile(filename) or filename.endswith('.diff'):
1081 continue
1082 with open(filename, 'rt') as file_:
1083 datestr = None
1084 platform = None
1085 py_version = None
1086 client_version = None
1087 compiler = None
1088 for line in file_:
1089 line = line.strip()
1090 if line.startswith('cppcheck: '):
1091 if OLD_VERSION not in line:
1092 # Package results seem to be too old, skip
1093 break
1094 if not datestr:
1095 break
1096
1097 dt = dateTimeFromStr(datestr)
1098
1099 if platform and not platform in platforms or dt < dateTimeFromStr(platforms[platform]):
1100 platforms[platform] = datestr
1101 if py_version and not py_version in py_versions or dt < dateTimeFromStr(py_versions[py_version]):
1102 py_versions[py_version] = datestr
1103 if client_version and not client_version in client_versions or dt < dateTimeFromStr(client_versions[client_version]):
1104 client_versions[client_version] = datestr
1105 if compiler and not compiler in compilers or dt < dateTimeFromStr(compilers[compiler]):
1106 compilers[compiler] = datestr
1107 break # stop processing
1108
1109 if datestr is None and line.startswith(str(current_year) + '-') or line.startswith(str(current_year - 1) + '-'):
1110 datestr = line
1111 elif line.startswith('platform:'):
1112 platform = line.split(' ', 1)[1]
1113 elif line.startswith('python:'):
1114 py_version = line.split(' ',1 )[1]
1115 elif line.startswith('client-version:'):
1116 client_version = line.split(' ', 1)[1]
1117 elif line.startswith('compiler:'):
1118 compiler = line.split(' ', 1)[1]
1119
1120 html += '<pre>\n'
1121 html += 'Client versions:\n'
1122 for clv in client_versions:
1123 html += clv + ' - ' + client_versions[clv] + '\n'
1124 html += '\n'
1125 html += 'Python versions:\n'

Callers 1

runMethod · 0.85

Calls 2

dateTimeFromStrFunction · 0.85
strFunction · 0.85

Tested by

no test coverage detected