cppcheck-htmlreport now takes a --title parameter that will be displayed on top of every page.
This commit is contained in:
parent
c4775b7ee4
commit
f6c24f9070
|
@ -115,7 +115,7 @@ HTML_HEAD = """
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>CppCheck - Html report</title>
|
||||
<title>CppCheck - Html report - %s</title>
|
||||
<link href="style.css" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">
|
||||
%s
|
||||
|
@ -127,7 +127,7 @@ HTML_HEAD = """
|
|||
</div>
|
||||
<div id="page">
|
||||
<div id="header">
|
||||
<h1>CppCheck report</h1>
|
||||
<h1>CppCheck report - %s</h1>
|
||||
</div>
|
||||
<div id="menu">
|
||||
<a href="index.html">Defect list</a>
|
||||
|
@ -195,6 +195,7 @@ class CppCheckHandler(XmlContentHandler):
|
|||
if __name__ == '__main__':
|
||||
# Configure all the options this little utility is using.
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option("--title", dest="title", help="The title of the project.", default="[project name]")
|
||||
parser.add_option("--file", dest="file", help="The cppcheck xml output file to read defects from. Default is reading from stdin.")
|
||||
parser.add_option("--report-dir", dest="report_dir", help="The directory where the html report content is written.")
|
||||
parser.add_option("--source-dir", dest="source_dir", help="Base directory where source code files can be found.")
|
||||
|
@ -265,7 +266,7 @@ if __name__ == '__main__':
|
|||
htmlFormatter = AnnotateCodeFormatter(linenos=True, style='colorful', hl_lines=lines, lineanchors="line")
|
||||
htmlFormatter.errors = errors
|
||||
stream = file(os.path.join(options.report_dir, htmlfile), "w")
|
||||
stream.write(HTML_HEAD % htmlFormatter.get_style_defs(".highlight"))
|
||||
stream.write(HTML_HEAD % (options.title, htmlFormatter.get_style_defs(".highlight"), options.title))
|
||||
stream.write(highlight(content, guess_lexer_for_filename(source_file, ""), htmlFormatter))
|
||||
stream.write(HTML_FOOTER)
|
||||
stream.close()
|
||||
|
@ -276,7 +277,7 @@ if __name__ == '__main__':
|
|||
# all the errors created.
|
||||
print("Creating index.html")
|
||||
stream = file(os.path.join(options.report_dir, "index.html"), "w")
|
||||
stream.write(HTML_HEAD % "")
|
||||
stream.write(HTML_HEAD % (options.title, "", options.title))
|
||||
stream.write("<table>")
|
||||
stream.write("<tr><th>Line</th><th>Id</th><th>Severity</th><th>Message</th></tr>")
|
||||
for filename, data in files.iteritems():
|
||||
|
|
Loading…
Reference in New Issue