From d2564c6100062476182006fc9e3ba34d2078facf Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Thu, 18 Aug 2016 18:29:19 +0200
Subject: [PATCH] added cppcheck target for travis

---
 .travis.yml | 14 ++++++++++++++
 Makefile    |  3 +--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index ad1d12d9..bd806cb8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,6 +41,20 @@ matrix:
     after_success:
       - valgrind --error-exitcode=1 --leak-check=full test/json_unit
 
+  # cppcheck
+
+  - os: linux
+    compiler: gcc
+    env:
+      - COMPILER=g++-4.9
+      - SPECIAL=cppcheck
+    addons:
+      apt:
+        sources: ['ubuntu-toolchain-r-test']
+        packages: [g++-4.9, cppcheck]
+    after_success:
+      - make cppcheck
+
   # Coveralls (http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
 
   - os: linux
diff --git a/Makefile b/Makefile
index f08d5cf3..b53d8d3d 100644
--- a/Makefile
+++ b/Makefile
@@ -64,8 +64,7 @@ fuzz: test/src/fuzz.cpp src/json.hpp
 
 # call cppcheck on the main header file
 cppcheck:
-	cppcheck --enable=all --inconclusive --std=c++11 src/json.hpp
-
+	cppcheck --enable=warning --inconclusive --force --std=c++11 src/json.hpp --error-exitcode=1
 
 ##########################################################################
 # maintainer targets