diff --git a/.travis.yml b/.travis.yml index bb0ad50ba4fa8a06694b98e25d8295ed33b2a003..a4bffb54d4f232852fb16c228528b58e93ef0601 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ install: binutils-avr \ avr-libc \ cppcheck \ + doxygen - git config --global user.email "travis@example.com" - git config --global user.name "Travis CI" @@ -46,6 +47,8 @@ script: - ./dist/tools/licenses/check.sh master --diff-filter=MR --error-exitcode=0 || exit - ./dist/tools/licenses/check.sh master --diff-filter=AC || exit + - ./dist/tools/doccheck/check.sh master || exit + - ./dist/tools/externc/check.sh master || exit # TODO: diff --git a/dist/tools/doccheck/check.sh b/dist/tools/doccheck/check.sh index 28657e7b9dd0f626fde18fcdd3c59b63576a4f1d..51a980048c01d5bc3f3a1dd53d812cadcc48de3c 100755 --- a/dist/tools/doccheck/check.sh +++ b/dist/tools/doccheck/check.sh @@ -1,38 +1,45 @@ #!/bin/sh -TMP1=$(mktemp) -TMP2=$(mktemp) +# Copyright 2014 Oliver Hahm <oliver.hahm@inria.fr> +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. + +TMP_ERR=$(mktemp) +TMP_WARN=$(mktemp) +TMP_DOC=$(mktemp) +ERR_DIFFFILTER="--diff-filter=AC" +WARN_DIFFFILTER="--diff-filter=MR" # If no branch but an option is given, unset BRANCH. # Otherwise, consume this parameter. BRANCH="${1}" if echo "${BRANCH}" | grep -q '^-'; then - BRANCH="" + if [ $(git rev-parse --abbrev-ref HEAD) != "master" ]; then + BRANCH="master" + else + BRANCH="" + fi else if [ -n "${BRANCH}" ]; then shift 1 fi fi -# If the --diff-filter option is given, consume this parameter. -# Set the default DIFFFILTER option otherwise. -DIFFFILTER="${1}" -if echo "${DIFFFILTER}" | grep -q '^--diff-filter='; then - shift 1 -else - DIFFFILTER="--diff-filter=ACMR" -fi # select files to check if [ -z "${BRANCH}" ]; then - git ls-tree -r --full-tree --name-only HEAD | grep -E '\.([sSch]|cpp)$' | sort | uniq > ${TMP1} + git ls-tree -r --full-tree --name-only HEAD | grep -E '\.([sSch]|cpp)$' | sort | uniq > ${TMP_WARN} else - git diff ${DIFFFILTER} --name-only ${BRANCH} | grep -E '\.([sSchp]|cpp)$' | sort | uniq > ${TMP1} + git diff ${ERR_DIFFFILTER} --name-only $(git merge-base ${BRANCH} HEAD) | grep -E '\.([sSchp]|cpp)$' | sort | uniq > ${TMP_ERR} + git diff ${WARN_DIFFFILTER} --name-only $(git merge-base ${BRANCH} HEAD) | grep -E '\.([sSchp]|cpp)$' | sort | uniq > ${TMP_WARN} fi -make doc 2>&1 | grep warning | grep -E '^\/' | sed "s#${PWD}\/\([^:]*\).*#\1#" | sort | uniq > ${TMP2} +make doc 2>&1 | grep '^\/.*warning' | sed "s#${PWD}/\([^:]*\).*#\1#" | sort | uniq > ${TMP_DOC} -WARNINGS=$(comm -1 -2 ${TMP1} ${TMP2}) +WARNINGS=$(comm -1 -2 ${TMP_WARN} ${TMP_DOC}) +ERRORS=$(comm -1 -2 ${TMP_ERR} ${TMP_DOC}) rm ${TMP_ERR} ${TMP_WARN} ${TMP_DOC} @@ -42,9 +49,10 @@ echo "WARNING: The following modified files generate doxygen warnings:" echo "${WARNINGS}" fi -if [ -n "${WARNINGS}" ] +if [ -n "${ERRORS}" ] then - echo "The following files generate doxygen warnings: ${WARNINGS}" + echo "ERROR: The following new files generate doxygen warnings:" + echo "${ERRORS}" exit 2 else exit 0