diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport index 20f848dad..a5434d96f 100755 --- a/htmlreport/cppcheck-htmlreport +++ b/htmlreport/cppcheck-htmlreport @@ -215,6 +215,17 @@ HTML_HEAD = """ clickable.onclick = toggle; } } + function set_class_display(c, st) { + var elements = document.querySelectorAll('.' + c), + len = elements.length; + for (i = 0; i < len; i++) { + elements[i].style.display = st; + } + } + function toggle_class_visibility(id) { + var box = document.getElementById(id); + set_class_display(id, box.checked ? '' : 'none'); + } @@ -547,12 +558,18 @@ if __name__ == '__main__': except IndexError: cnt_min = 0 + stat_fmt = " {}{}" for occurrences in reversed(range(cnt_min, cnt_max + 1)): for _id in [k for k, v in sorted(counter.items()) if v == occurrences]: - stat_html.append(" " + str(dict(counter.most_common())[_id]) + " " + str(_id) + "
\n") + stat_html.append(stat_fmt.format(_id, _id, dict(counter.most_common())[_id], _id)) output_file.write(HTML_HEAD.replace('id="menu" dir="rtl"', 'id="menu_index"', 1).replace("Defects:", "Defect summary;", 1) % (options.title, '', options.title, '', '')) - output_file.write('

\n' + ' ' + str(stats_count) + ' total

\n' + ''.join(stat_html) + '

Statistics

') + output_file.write(' ') + output_file.write(' ') + output_file.write(''.join(stat_html)) + output_file.write(' ') + output_file.write('
Show#Defect ID
' + str(stats_count) + 'total
') + output_file.write(' Statistics

') output_file.write(HTML_HEAD_END.replace("content", "content_index", 1)) output_file.write(' \n') @@ -591,17 +608,17 @@ if __name__ == '__main__': error_class = 'class="error"' if error['id'] == 'missingInclude': output_file.write( - '\n ' % - (error['id'], error['severity'], error['msg'])) + '\n ' % + (error['id'], error['id'], error['severity'], error['msg'])) elif (error['id'] == 'unmatchedSuppression') and filename.endswith('*'): output_file.write( - '\n ' % - (error['id'], error['severity'], error_class, + '\n ' % + (error['id'], error['id'], error['severity'], error_class, error['msg'])) else: output_file.write( - '\n ' % - (data['htmlfile'], error['line'], error['line'], + '\n ' % + (error['id'], data['htmlfile'], error['line'], error['line'], error['id'], cwe_url, error['severity'], error_class, error['msg']))
%s%s%s
%s%s%s
%s%s%s
%s%s%s
%d%s%s%s%s
%d%s%s%s%s