Skip to content

Commit 0ffa81d

Browse files
committed
htmlreport: show filename of currently viewed file in defect list
1 parent 95923cb commit 0ffa81d

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

htmlreport/cppcheck-htmlreport

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ div.verbose div.content {
114114
z-index: 1;
115115
}
116116
117+
#filename {
118+
margin-left: 10px;
119+
font: 12px;
120+
z-index: 1;
121+
}
122+
117123
.highlighttable {
118124
background-color:white;
119125
z-index: 10;
@@ -216,8 +222,7 @@ HTML_HEAD = """
216222
<h1>Cppcheck report - %s: %s </h1>
217223
</div>
218224
<div id="menu" dir="rtl">
219-
<a href="index.html">Defect list</a>
220-
<br>
225+
<p id="filename"><a href="index.html">Defects:</a> %s</p>
221226
"""
222227

223228
HTML_HEAD_END = """
@@ -460,7 +465,8 @@ if __name__ == '__main__':
460465
(options.title,
461466
htmlFormatter.get_style_defs('.highlight'),
462467
options.title,
463-
filename))
468+
filename,
469+
filename.split('/')[-1]))
464470

465471
for error in sorted(errors, key=lambda k: k['line']):
466472
output_file.write("<a href='%s#line-%d'> %s %s</a>" % (data['htmlfile'], error['line'], error['id'], error['line']))
@@ -516,7 +522,7 @@ if __name__ == '__main__':
516522
for _id in [k for k, v in sorted(Counter(stats).items()) if v == occurrences]:
517523
stat_html.append(" " + str(dict(Counter(stats).most_common())[_id]) + " " + str(_id) + "<br/>\n")
518524

519-
output_file.write(HTML_HEAD.replace('id="menu" dir="rtl"', 'id="menu_index"', 1).replace("Defect list", "Defect summary", 1) % (options.title, '', options.title, ''))
525+
output_file.write(HTML_HEAD.replace('id="menu" dir="rtl"', 'id="menu_index"', 1).replace("Defects:", "Defect summary;", 1) % (options.title, '', options.title, '', ''))
520526
output_file.write(' <p>\n' + ' ' + str(stats_count) + ' total<br/><br/>\n' + ''.join(stat_html) + ' </p>')
521527
output_file.write(HTML_HEAD_END.replace("content", "content_index", 1))
522528
output_file.write(' <table>\n')

0 commit comments

Comments
 (0)