diff --git a/tools/warn.py b/tools/warn.py index a4a9e16bb9..b61505b6b4 100755 --- a/tools/warn.py +++ b/tools/warn.py @@ -1683,8 +1683,41 @@ warnpatterns = [ ] anchor = 0 -cur_row_color = 0 -row_colors = [ 'e0e0e0', 'd0d0d0' ] +cur_row_class = 0 + +html_script_style = """\ + + \n""" + def output(text): print text, @@ -1693,39 +1726,23 @@ def htmlbig(param): return '' + param + '' def dumphtmlprologue(title): - output('\n
\n\n') +def dumphtmlepilogue(): + output('\n\n\n') + def tablerow(text): - global cur_row_color - output('
')
- output(htmlbig(text[0]) + ' ') - for i in text[1:]: - output(i + ' ') - output(' | ')
- output('' +
- 'top ' + - 'previous ' + - 'next') - output(' |
') - + global cur_row_class + output('
\n')
+ output('
\n')
+ output(' ' +
+ '')
+ output('
\n')
-# dump count of warnings of a given severity in TOC
-def dumpcount(sev):
- first = True
- for i in warnpatterns:
- if i['severity'] == sev and len(i['members']) > 0:
- if first:
- output(headerforseverity(sev) + ':\n
' + - '\n') - -# dump table of content, list of all warning patterns -def dumptoc(): - n = 1 +# dump everything for a given severity +def dumpseverity(sev): + global anchor + output('\n') - output('
' + - ' \n') - first = False - if not first: - output('' + descriptionfor(i) + - ' (' + str(len(i['members'])) + ')
\n') for i in warnpatterns: - i['anchor'] = 'Warning' + str(n) - n += 1 - dumpcount(severity.FIXMENOW) - dumpcount(severity.HIGH) - dumpcount(severity.MEDIUM) - dumpcount(severity.LOW) - dumpcount(severity.TIDY) - dumpcount(severity.HARMLESS) - dumpcount(severity.UNKNOWN) - output('\n
\n') + if i['severity'] == sev and len(i['members']) > 0: + output('\n
' + descriptionfor(i) + + ' (' + str(len(i['members'])) + ') |
' + + ' Fixed warnings. ' + + 'No more occurences. Please consider turning these into ' + + 'errors if possible, before they are reintroduced in to the build' + + ':
\n') + output('\n') + fixed_patterns = [] for i in warnpatterns: if len(i['members']) == 0 and i['severity'] != severity.SKIP: - if tablestarted == False: - tablestarted = True - begintable(['Fixed warnings', 'No more occurences. Please consider turning these in to errors if possible, before they are reintroduced in to the build'], 'blue', '') - tablerow(i['description'] + ' (' + allpatterns(i) + ') ' + i['option']) - if tablestarted: - endtable() + fixed_patterns.append(i['description'] + ' (' + + allpatterns(i) + ') ' + i['option']) + fixed_patterns.sort() + output('\n') def warningwithurl(line): if not args.url: @@ -1821,17 +1846,12 @@ def dumpcategory(cat): header = [descriptionfor(cat),str(len(cat['members'])) + ' occurences:'] if cat['option'] != '': header[1:1] = [' (related option: ' + cat['option'] +')'] - begintable(header, colorforseverity(cat['severity']), cat['anchor']) + + output(' \n') + output(' \n') def classifywarning(line): @@ -1895,7 +1915,6 @@ dumpstats() # sort table based on number of members once dumpstats has deduplicated the # members. warnpatterns.sort(reverse=True, key=lambda i: len(i['members'])) -dumptoc() dumpseverity(severity.FIXMENOW) dumpseverity(severity.HIGH) dumpseverity(severity.MEDIUM) @@ -1904,3 +1923,4 @@ dumpseverity(severity.TIDY) dumpseverity(severity.HARMLESS) dumpseverity(severity.UNKNOWN) dumpfixed() +dumphtmlepilogue()