#!/usr/bin/env python import os import sys def readdate(data): if data[:5] == 'DATE ': datepos = 0 else: datepos = data.find('\nDATE ') if datepos >= 0: datepos += 1 if datepos < 0: return None datestr = '' datepos += 5 while True: if datepos >= len(data): return None d = data[datepos] if '0' <= d <= '9': datestr += d elif d == '\n' or d == '\r': if len(datestr) == 8: return datestr[:4] + '-' + datestr[4:6] + '-' + datestr[6:] return None elif d != ' ' and d != '-': return None datepos += 1 daca2folder = os.path.expanduser('~/daca2/') path = '' for arg in sys.argv[1:]: if arg.startswith('--daca2='): daca2folder = arg[8:] if daca2folder[-1] != '/': daca2folder += '/' else: path = arg if path[-1] != '/': path += '/' mainpage = open(path + 'daca2.html', 'wt') mainpage.write('\n') mainpage.write('\n') mainpage.write('\n') mainpage.write('\n') mainpage.write('DACA2\n') mainpage.write('\n') mainpage.write('\n') mainpage.write('\n') mainpage.write('\n') mainpage.write('

DACA2

\n') mainpage.write('

Results when running latest (git head) Cppcheck on Debian.

\n') mainpage.write('

For performance reasons the analysis is limited. Files larger than 1mb are skipped. ' + 'If analysis of a file takes more than 10 minutes it may be stopped.

\n') mainpage.write('\n') mainpage.write( '' + '' + '' + '' + '' + '' + '' + '' + '' + '\n') lastupdate = None recent = [] daca2 = daca2folder for lib in (False, True): for a in "0123456789abcdefghijklmnopqrstuvwxyz": if lib: a = "lib" + a if not os.path.isfile(daca2 + a + '/results.txt'): continue f = open(daca2 + a + '/results.txt', 'rt') data = f.read() f.close() if 'ftp://' not in data: continue datestr = readdate(data) if datestr: if not lastupdate or datestr > lastupdate: lastupdate = datestr recent = [] if datestr == lastupdate: recent.append(a) else: datestr = '' mainpage.write( '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '\n') data = data.replace('&', '&') data = data.replace('<', '<') data = data.replace('>', '>') data = data.replace('\n', '\n') f = open(path + 'daca2-' + a + '.html', 'wt') f.write('\n') f.write('\n') f.write('\n') f.write('\n') f.write('DACA2 - ' + a + '\n') f.write('\n') f.write('\n') f.write('

DACA2 - ' + a + '

') f.write('
\n' + data + '
\n') f.write('\n') f.write('\n') f.close() mainpage.write('
NameDateErrorWarningPerformancePortabilityStyleCrashesVarID 0
' + a + '' + datestr + '' + str(data.count(': error:')) + '' + str(data.count(': warning:')) + '' + str(data.count(': performance:')) + '' + str(data.count(': portability:')) + '' + str(data.count(': style:')) + '' + str(data.count('Crash?')) + '' + str(data.count('with varid 0.')) + '
\n') if lastupdate: mainpage.write('

Last update: ' + lastupdate + '

') allrecent = '' for r in recent: allrecent = allrecent + ' ' + r + '' mainpage.write('

Most recently updated:' + allrecent + '

') mainpage.write('\n') mainpage.write('\n')