Skip to content

Commit ca4a0af

Browse files
committed
htmlreport: remove redundant <style> tags, make html output readable.
1 parent 9e90bed commit ca4a0af

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

htmlreport/cppcheck-htmlreport

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ HTML_HEAD = """
110110
<meta charset="utf-8">
111111
<title>Cppcheck - HTML report - %s</title>
112112
<link rel="stylesheet" href="style.css">
113-
<style>
114-
%s
115-
</style>
116113
</head>
117114
<body>
118115
<div id="page">
@@ -305,7 +302,7 @@ if __name__ == '__main__':
305302
'w') as output_file:
306303
output_file.write(HTML_HEAD %
307304
(options.title,
308-
htmlFormatter.get_style_defs('.highlight'),
305+
#htmlFormatter.get_style_defs('.highlight'),
309306
options.title))
310307

311308
lexer = guess_lexer_for_filename(source_filename, '')
@@ -325,13 +322,13 @@ if __name__ == '__main__':
325322
print('Creating index.html')
326323
with io.open(os.path.join(options.report_dir, 'index.html'),
327324
'w') as output_file:
328-
output_file.write(HTML_HEAD % (options.title, '', options.title))
329-
output_file.write('<table>')
325+
output_file.write(HTML_HEAD % (options.title, options.title))
326+
output_file.write(' <table>\n')
330327
output_file.write(
331-
'<tr><th>Line</th><th>Id</th><th>Severity</th><th>Message</th></tr>')
328+
' <tr><th>Line</th><th>Id</th><th>Severity</th><th>Message</th></tr>')
332329
for filename, data in sorted(files.items()):
333330
output_file.write(
334-
"<tr><td colspan='4'><a href='%s'>%s</a></td></tr>" %
331+
"\n <tr><td colspan='4'><a href='%s'>%s</a></td></tr>" %
335332
(data['htmlfile'], filename))
336333
for error in data['errors']:
337334
if error['severity'] == 'error':
@@ -341,15 +338,15 @@ if __name__ == '__main__':
341338

342339
if error['id'] == 'missingInclude':
343340
output_file.write(
344-
'<tr><td></td><td>%s</td><td>%s</td><td>%s</td></tr>' %
341+
'\n <tr><td></td><td>%s</td><td>%s</td><td>%s</td></tr>' %
345342
(error['id'], error['severity'], error['msg']))
346343
else:
347344
output_file.write(
348-
"<tr><td><a href='%s#line-%d'>%d</a></td><td>%s</td><td>%s</td><td %s>%s</td></tr>" %
345+
"\n <tr><td><a href='%s#line-%d'>%d</a></td><td>%s</td><td>%s</td><td %s>%s</td></tr>" %
349346
(data['htmlfile'], error['line'], error['line'],
350347
error['id'], error['severity'], error_class,
351348
error['msg']))
352-
output_file.write('</table>')
349+
output_file.write('\n </table>')
353350
output_file.write(HTML_FOOTER % contentHandler.versionCppcheck)
354351

355352
print('Creating style.css file')

0 commit comments

Comments
 (0)