shithub: choc

Download patch

ref: 63141cfc0d8cfa180c5a98e50c10a81faea5abef
parent: a89a0e655d6a10d2d3951fb2f129d8ccdd2a4945
author: turol <turol@users.noreply.github.com>
date: Sun Sep 3 19:29:27 EDT 2017

Add cppcheck static analysis to travis build (#939)

This runs cppcheck static analysis as part of the travis-ci checks. The
current Travis version of cppcheck doesn't appear to support all the checks
we want, but for now should be sufficient. Identified issues that would cause
these checks to fail have been resolved in previous commits.

Thanks to @turol for doing the work to set this up.

--- /dev/null
+++ b/.travis.sh
@@ -1,0 +1,10 @@
+#!/bin/sh
+set -e
+if [ "$ANALYZE" = "true" ] ; then
+	cppcheck --error-exitcode=1 -j2 -UTESTING -Iopl -Isrc -Isrc/setup opl pcsound src textscreen > /dev/null
+else
+	./autogen.sh
+	make
+	make install DESTDIR=/tmp/whatever
+	make dist
+fi
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,9 +7,14 @@
 sudo: required
 dist: trusty
 
+env:
+    - ANALYZE=false
+    - ANALYZE=true
+
 addons:
     apt:
         packages:
+        - cppcheck
         - libsdl2-dev
         - libsdl2-mixer-dev
         - libsdl2-net-dev
@@ -16,7 +21,7 @@
         - libsdl2-image-dev
         - libsamplerate0-dev
 
-script: ./autogen.sh && make && make install DESTDIR=/tmp/whatever && make dist
+script: ./.travis.sh
 
 branches:
     only: