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

Function timeoutReport

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

Source from the content-addressed store, hash-verified

306
307
308def timeoutReport(results_path: str) -> str:
309 html = '<!DOCTYPE html>\n'
310 html += '<html><head><title>Timeout report</title></head><body>\n'
311 html += '<h1>Timeout report</h1>\n'
312 html += '<pre>\n'
313 html += '<b>' + fmt('Package', 'Date Time', OLD_VERSION, 'Head', link=False) + '</b>\n'
314 current_year = datetime.date.today().year
315 for filename in sorted(glob.glob(os.path.expanduser(results_path + '/*'))):
316 if not os.path.isfile(filename) or filename.endswith('.diff'):
317 continue
318 with open(filename, 'rt') as file_:
319 datestr = None
320 for line in file_:
321 line = line.strip()
322 if line.startswith('cppcheck: '):
323 if OLD_VERSION not in line:
324 # Package results seem to be too old, skip
325 break
326 # Current package, parse on
327 continue
328 if datestr is None and line.startswith(str(current_year) + '-') or line.startswith(str(current_year - 1) + '-'):
329 datestr = line
330 elif line.startswith('count:'):
331 if line.find('TO!') < 0:
332 break
333 package = pkg_from_file(filename)
334 counts = line.split(' ')
335 c2 = ''
336 if counts[2] == 'TO!':
337 c2 = 'Timeout'
338 c1 = ''
339 if counts[1] == 'TO!':
340 c1 = 'Timeout'
341 html += fmt(package, datestr, c2, c1) + '\n'
342 break
343
344 html += '</pre>\n'
345 html += '</body></html>\n'
346 return html
347
348
349def staleReport(results_path: str, query_params: dict) -> str:

Callers 1

runMethod · 0.85

Calls 4

fmtFunction · 0.85
strFunction · 0.85
pkg_from_fileFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected