]> git.localhorst.tv Git - blank.git/commitdiff
cppcheck for linting
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 11 Nov 2016 13:01:05 +0000 (14:01 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 11 Nov 2016 15:28:48 +0000 (16:28 +0100)
not calling on travis for now because of all the false positives

and the true positives

just a sec

Makefile
doc/building
doc/running
scripts/docker/archlinux-build/Dockerfile
scripts/docker/centos-build-latest/Dockerfile
scripts/docker/debian-build-latest/Dockerfile
scripts/docker/debian-build-testing/Dockerfile
scripts/docker/ubuntu-build-devel/Dockerfile
scripts/docker/ubuntu-build-latest/Dockerfile

index 2fb2f20b44f2cc4e30ed376798c280b14227d37e..4a52c99e5e10b957be61f1f0a43c789dd0214130 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,8 @@
 CXX = g++ --std=c++11
 LDXX = g++
+CPPCHECK = cppcheck -q --std=c++11 \
+       --enable=warning,style,performance,portability,unusedFunction,missingInclude \
+       --error-exitcode=1
 
 LIBS = sdl2 SDL2_image SDL2_net SDL2_ttf glew openal freealut zlib
 
@@ -151,6 +154,12 @@ codecov: coverage
        @echo run: codecov.io
        @bash -c 'bash <(curl -s https://codecov.io/bash) -Z'
 
+lint:
+       @echo lint: source
+       @$(CPPCHECK) $(SOURCE_DIR)
+       @echo lint: tests
+       @$(CPPCHECK) -I $(SOURCE_DIR) $(TEST_SRC_DIR)
+
 clean:
        rm -f $(OBJ)
        rm -f $(DEP)
@@ -160,7 +169,7 @@ distclean: clean
        rm -f $(BIN) cachegrind.out.* callgrind.out.*
        rm -Rf build client-saves saves
 
-.PHONY: all release cover debug profile tests run gdb cachegrind callgrind test coverage codecov clean distclean
+.PHONY: all release cover debug profile tests run gdb cachegrind callgrind test coverage codecov lint clean distclean
 
 -include $(DEP)
 
index 43b5cb94ef563b254bb504313e6b959aeacfee75..8481dd426555479dbe97823557dfc2a41c5b4fb3 100644 (file)
@@ -4,17 +4,28 @@ Dependencies
        GLEW, GLM, SDL2, SDL2_image, SDL2_net, SDL2_ttf, OpenAL, freealut, zlib
 
        CppUnit for tests
+       Cppcheck for linting
 
-archlinux: pacman -S glew glm sdl2 sdl2_image sdl2_net sdl2_ttf openal freealut zlib cppunit
-debian: apt-get install libglew-dev libglm-dev libsdl2-dev libsdl2-image-dev libsdl2-net-dev libsdl2-ttf-dev libopenal-dev libalut-dev zlib1g-dev libcppunit-dev
+archlinux: pacman -S \
+       glew glm sdl2 sdl2_image sdl2_net sdl2_ttf openal freealut zlib \
+       cppunit cppcheck
+
+debian: apt install \
+       libglew-dev libglm-dev libsdl2-dev libsdl2-image-dev libsdl2-net-dev \
+       libsdl2-ttf-dev libopenal-dev libalut-dev zlib1g-dev \
+       libcppunit-dev cppcheck
 
-debian (jessie): apt-get install libglew-dev libglm-dev libsdl2-dev libsdl2-image-dev libsdl2-net-dev libsdl2-ttf-dev libopenal-dev libalut-dev zlib1g-dev libcppunit-dev
        (!) you may have to build the tests with CPPFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
 
-centos (7): yum install glew-devel glm-devel SDL2-devel SDL2_image-devel SDL2_net-devel SDL2_ttf-devel openal-soft-devel freealut-devel zlib-devel cppunit-devel
+centos: yum install \
+       glew-devel glm-devel SDL2-devel SDL2_image-devel SDL2_net-devel \
+       SDL2_ttf-devel openal-soft-devel freealut-devel zlib-devel \
+       cppunit-devel cppcheck
+
        (!) you need the "epel" repository for SDL2 et al. `yum install epel-release`
 
 manual:
+       Cppcheck: http://cppcheck.sourceforge.net/
        CppUnit http://sourceforge.net/projects/cppunit/
        GLEW    http://glew.sourceforge.net/
        GLM     http://glm.g-truc.net/0.9.6/index.html
index 7c54d441965a6a34302bb1414b05006e370d3ac5..60dfe031127e545ad9e2e519a90e10ad99a66a5a 100644 (file)
@@ -4,13 +4,17 @@ Dependencies
        GLEW, GLM, SDL2, SDL2_image, SDL2_net, SDL2_ttf, OpenAL, freealut, zlib
 
 archlinux:
-       pacman -S glew glm sdl2 sdl2_image sdl2_net sdl2_ttf openal freealut zlib
+       pacman -S \
+               glew glm sdl2 sdl2_image sdl2_net sdl2_ttf openal freealut zlib
 
-debian (jessie):
-       apt install --no-install-recommends libglew1.10 libglu1-mesa libsdl2-2.0-0 libsdl2-image-2.0-0 libsdl2-net-2.0-0 libsdl2-ttf-2.0-0 libopenal1 libalut0 zlib1g
+debian:
+       apt install --no-install-recommends \
+               libglew1.10 libglu1-mesa libsdl2-2.0-0 libsdl2-image-2.0-0 \
+               libsdl2-net-2.0-0 libsdl2-ttf-2.0-0 libopenal1 libalut0 zlib1g
 
-centos (7):
-       yum install glew SDL2 SDL2_image SDL2_net SDL2_ttf openal-soft freealut zlib
+centos:
+       yum install \
+               glew SDL2 SDL2_image SDL2_net SDL2_ttf openal-soft freealut zlib
 
 Arguments
 =========
index 37b10420fcc12394f9ac8f4cbd3f06d7ec96775b..12d26f60ce3cee6b72e29ddd226f562277bc2921 100644 (file)
@@ -1,6 +1,7 @@
 FROM rafaelsoares/archlinux-devel
 
 RUN sudo pacman -S --noconfirm \
+       cppcheck \
        cppunit \
        freealut \
        git \
index 6118d6e0c204e1834367e7ed78cbbac84762b0d8..33312768d3abc9bc15ae0b058441f0a355a7958b 100644 (file)
@@ -5,6 +5,7 @@ RUN yum -y update \
        && yum -y update \
        && yum -y group install "Development Tools"
 RUN yum -y install \
+       cppcheck \
        cppunit-devel \
        freealut-devel \
        glew-devel \
index 4d4bdaf14a6285009b7c759e0fc2aa03485471f6..79b8fcf5923380dc2ece8e8fe71562b326695e93 100644 (file)
@@ -3,6 +3,7 @@ FROM debian:latest
 RUN apt update \
        && apt -y install build-essential
 RUN apt -y install --no-install-recommends \
+       cppcheck \
        libalut-dev \
        libcppunit-dev \
        libglew-dev \
index 54e8542a88d613e42043d0495073ef1d3a40bc3d..8b422eaa300474dde66bc821e6bb842ba61578ee 100644 (file)
@@ -3,6 +3,7 @@ FROM debian:testing
 RUN apt update \
        && apt -y install build-essential
 RUN apt -y install --no-install-recommends \
+       cppcheck \
        libalut-dev \
        libcppunit-dev \
        libglew-dev \
index 25c9f6f3c44ac68ebeab15ba3bbdd60ce530f4d2..0415f526a1c7ae78fe54400eeb32d5ea1bd3bf18 100644 (file)
@@ -3,6 +3,7 @@ FROM ubuntu:devel
 RUN apt update \
        && apt -y install build-essential
 RUN apt -y install --no-install-recommends \
+       cppcheck \
        libalut-dev \
        libcppunit-dev \
        libglew-dev \
index 8cfda8cf752c6ac4fe6a923dc59e5937227ffee8..ae344bd3c1da7db175506894c3384bd6cfb68b51 100644 (file)
@@ -3,6 +3,7 @@ FROM ubuntu:latest
 RUN apt update \
        && apt -y install build-essential
 RUN apt -y install --no-install-recommends \
+       cppcheck \
        libalut-dev \
        libcppunit-dev \
        libglew-dev \