diff --git a/.travis.yml b/.travis.yml index 22cd0c4..19b6125 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ before_install: install: - sudo apt-get install -y libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev - - sudo apt-get install -y cmake cmake-data check lua5.2 liblua5.2-dev + - sudo apt-get install -y cmake cmake-data check lua5.2 liblua5.2-dev cppcheck #g++6 - if [ "$CXX" = "g++" ]; then sudo apt-get install -y g++-6; fi @@ -39,3 +39,4 @@ script: - cmake .. - make - make test + - make lint diff --git a/CMakeLists.txt b/CMakeLists.txt index 08440e5..1db271b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,11 @@ if (NOT WIN32) -Wmissing-prototypes -Wconversion -Wno-sign-conversion ) + add_custom_target(lint + COMMENT "Running cppcheck" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND cppcheck --language=c --error-exitcode=1 --template=gcc --enable=warning,performance,portability,information,missingInclude --quiet src/* + ) endif (NOT WIN32) set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") diff --git a/Makefile b/Makefile index 31a672d..4a4129e 100644 --- a/Makefile +++ b/Makefile @@ -13,3 +13,7 @@ test: run: $(all) @./build/breakhack .PHONY: run + +lint: + @make lint -sC build +.PHONY: lint