← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~hjd/widelands/cppcheck-report into lp:widelands

 

Hans Joachim Desserud has proposed merging lp:~hjd/widelands/cppcheck-report into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~hjd/widelands/cppcheck-report/+merge/104020

Various improvements to the create_cppcheck_report script.
* The output report is now html5 rather than xhtml. Parts of source code which include the characters <> are interpreted as tags, which makes the document invalid. This cause xhtml to only display the error when present. From what I know only Opera offers a link to reparse the document as html, other browsers simply won't show the report. Not a problem for me, but probably not ideal for all. Therefore I switched to html5 doctype which has better defined behaviour for invalid markup. (I briefly looked into piping the output through sed and replace < with &lt; and > with &gt;, but I still ran into issues which I didn't investigate further.) Ideally this should produce valid markup, though.

* Added --std parameters to enable additional standard checks. These seem to be fairly new though, as I ran testruns with cppcheck 1.54, but cppcheck 1.49 did not recognize them.

* I added a headline displaying which version of cppcheck was used for generating the report. Might be useful in case people with different versions find issues other people aren't able to see due to older versions.

The rest of the changes are summarised in the commit messages.
-- 
https://code.launchpad.net/~hjd/widelands/cppcheck-report/+merge/104020
Your team Widelands Developers is requested to review the proposed merge of lp:~hjd/widelands/cppcheck-report into lp:widelands.
=== modified file 'utils/create_cppcheck_report'
--- utils/create_cppcheck_report	2010-11-15 21:23:02 +0000
+++ utils/create_cppcheck_report	2012-04-29 16:00:28 +0000
@@ -1,12 +1,14 @@
 #!/bin/bash
-FILE=cppcheck_report.xhtml
-echo "<?xml version=\"1.0\" encoding=\"us-ascii\"?>"                                                                     >  $FILE
-echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>" >> $FILE
-echo "<html xmlns=\"http://www.w3.org/1999/xhtml\";>"                                                                     >> $FILE
-echo "<head><title>cppcheck error report for Widelands C++ source code</title></head>"                                   >> $FILE
-echo "<body>"                                                                                                            >> $FILE
-echo "<div>"                                                                                                             >> $FILE
-cppcheck --force --quiet --enable=all -I src src 2>&1 | sed "s@^\[\(.*\):\([[:digit:]]\+\)\]: \(.*\)\$@<a href=\"http://bazaar.launchpad.net/%7Ewidelands-dev/widelands/trunk/annotate/head%3A/\1\?#L\2\";>\1:\2</a>: \3<br/>@" >> $FILE
-echo "</div>"                                                                                                            >> $FILE
-echo "</body>"                                                                                                           >> $FILE
-echo "</html>"                                                                                                           >> $FILE
+FILE=cppcheck_report.html
+echo "<!doctype html>"                                                                 >  $FILE
+echo "<html>"                                                                          >> $FILE
+echo "<head><title>cppcheck error report for Widelands C++ source code</title></head>" >> $FILE
+echo "<body>"                                                                          >> $FILE
+echo "<h2>Issues found by "                                                            >> $FILE
+cppcheck --version                                                                     >> $FILE
+echo "</h2>"                                                                           >> $FILE
+echo "<div>"                                                                           >> $FILE
+cppcheck --force --quiet --verbose --std=posix --std=c99 --std=c++11 --enable=all -I src src 2>&1 | sed "s@^\[\(.*\):\([[:digit:]]\+\)\]: \(.*\)\$@<a href=\"http://bazaar.launchpad.net/%7Ewidelands-dev/widelands/trunk/annotate/head%3A/\1\?#L\2\";>\1:\2</a>: \3<br/>@" >> $FILE
+echo "</div>"                                                                          >> $FILE
+echo "</body>"                                                                         >> $FILE
+echo "</html>"                                                                         >> $FILE


Follow ups