From b3c37033944671429f8db22c3754caef7add1695 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Fri, 11 Nov 2016 14:01:05 +0100 Subject: [PATCH] cppcheck for linting not calling on travis for now because of all the false positives and the true positives just a sec --- Makefile | 11 ++++++++++- doc/building | 19 +++++++++++++++---- doc/running | 14 +++++++++----- scripts/docker/archlinux-build/Dockerfile | 1 + scripts/docker/centos-build-latest/Dockerfile | 1 + scripts/docker/debian-build-latest/Dockerfile | 1 + .../docker/debian-build-testing/Dockerfile | 1 + scripts/docker/ubuntu-build-devel/Dockerfile | 1 + scripts/docker/ubuntu-build-latest/Dockerfile | 1 + 9 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 2fb2f20..4a52c99 100644 --- 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) diff --git a/doc/building b/doc/building index 43b5cb9..8481dd4 100644 --- a/doc/building +++ b/doc/building @@ -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 diff --git a/doc/running b/doc/running index 7c54d44..60dfe03 100644 --- a/doc/running +++ b/doc/running @@ -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 ========= diff --git a/scripts/docker/archlinux-build/Dockerfile b/scripts/docker/archlinux-build/Dockerfile index 37b1042..12d26f6 100644 --- a/scripts/docker/archlinux-build/Dockerfile +++ b/scripts/docker/archlinux-build/Dockerfile @@ -1,6 +1,7 @@ FROM rafaelsoares/archlinux-devel RUN sudo pacman -S --noconfirm \ + cppcheck \ cppunit \ freealut \ git \ diff --git a/scripts/docker/centos-build-latest/Dockerfile b/scripts/docker/centos-build-latest/Dockerfile index 6118d6e..3331276 100644 --- a/scripts/docker/centos-build-latest/Dockerfile +++ b/scripts/docker/centos-build-latest/Dockerfile @@ -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 \ diff --git a/scripts/docker/debian-build-latest/Dockerfile b/scripts/docker/debian-build-latest/Dockerfile index 4d4bdaf..79b8fcf 100644 --- a/scripts/docker/debian-build-latest/Dockerfile +++ b/scripts/docker/debian-build-latest/Dockerfile @@ -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 \ diff --git a/scripts/docker/debian-build-testing/Dockerfile b/scripts/docker/debian-build-testing/Dockerfile index 54e8542..8b422ea 100644 --- a/scripts/docker/debian-build-testing/Dockerfile +++ b/scripts/docker/debian-build-testing/Dockerfile @@ -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 \ diff --git a/scripts/docker/ubuntu-build-devel/Dockerfile b/scripts/docker/ubuntu-build-devel/Dockerfile index 25c9f6f..0415f52 100644 --- a/scripts/docker/ubuntu-build-devel/Dockerfile +++ b/scripts/docker/ubuntu-build-devel/Dockerfile @@ -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 \ diff --git a/scripts/docker/ubuntu-build-latest/Dockerfile b/scripts/docker/ubuntu-build-latest/Dockerfile index 8cfda8c..ae344bd 100644 --- a/scripts/docker/ubuntu-build-latest/Dockerfile +++ b/scripts/docker/ubuntu-build-latest/Dockerfile @@ -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 \ -- 2.39.2