Parcourir la source

Add cpplint to travis

Stefan Profanter il y a 6 ans
Parent
commit
f5a59afcc7

+ 3 - 0
.travis.yml

@@ -50,6 +50,9 @@ matrix:
     - os: linux
       compiler: clang
       env: FUZZER=true
+    - os: linux
+      compiler: gcc
+      env: LINT=true
     # - os: osx
     #   compiler: clang
     #   # disable homebrew auto update which takes a lot of time

+ 5 - 0
CMakeLists.txt

@@ -717,6 +717,11 @@ add_custom_target(lint ${CLANG_TIDY_PROGRAM}
                   COMMENT "Run clang-tidy on the library")
 add_dependencies(lint open62541)
 
+add_custom_target(cpplint cpplint
+                  ${lib_sources}
+                  DEPENDS ${lib_sources}
+                  COMMENT "Run cpplint code style checker on the library")
+
 ##########################
 # Installation           #
 ##########################

+ 1 - 0
tools/travis/travis_linux_before_install.sh

@@ -38,6 +38,7 @@ if [ -z ${DOCKER+x} ]; then
 	pip install --user cpp-coveralls
 	pip install --user sphinx
 	pip install --user sphinx_rtd_theme
+	pip install --user cpplint
 	echo -en 'travis_fold:end:script.before_install.python\\r'
 
 	echo "=== Installed versions are ===" && echo -en 'travis_fold:start:before_install.versions\\r'

+ 10 - 0
tools/travis/travis_linux_script.sh

@@ -11,6 +11,16 @@ if ! [ -z ${DOCKER+x} ]; then
     exit 0
 fi
 
+# Cpplint checking
+if ! [ -z ${LINT+x} ]; then
+	mkdir -p build
+	cd build
+	cmake ..
+	make cpplint
+	if [ $? -ne 0 ] ; then exit 1 ; fi
+    exit 0
+fi
+
 # Fuzzer build test
 if ! [ -z ${FUZZER+x} ]; then
     # Test the corpus generator and use new corpus for fuzz test