Skip to content

Commit

Permalink
Merge pull request #1467 from ivangalkin/executetidy
Browse files Browse the repository at this point in the history
travis.yml: execute automatic HTML checks for rules files
  • Loading branch information
guwirth authored Apr 27, 2018
2 parents 08d63c7 + 42cfce7 commit b130565
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ before_install:
#- travis_retry sudo apt-add-repository -y ppa:boost-latest/ppa
#- travis_retry sudo apt-get -qq update
#- travis_retry sudo apt-get -qq install boost1.55
- travis_retry sudo apt-get -qq install libxml2-utils

install:
- cd /tmp
- pushd /tmp
- travis_retry wget -q https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.7.3.zip
- unzip -qq sonarqube-6.7.3.zip
- travis_retry wget -q https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-7.0.zip
Expand All @@ -48,7 +49,12 @@ install:
- unzip -qq sonarqube-7.1.zip
- travis_retry wget -q https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.1.0.1141.zip
- unzip -qq sonar-scanner-cli-3.1.0.1141.zip
- cd -
- travis_retry wget -q https://github.com/htacg/tidy-html5/archive/5.6.0.zip --output-document=tidy-html5.zip
- unzip -qq tidy-html5.zip
- pushd tidy-html5-5.6.0/build/cmake/
- cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/tidy-html5-5.6.0 && make && make install && PATH=$PATH:/tmp/tidy-html5-5.6.0/bin
- popd
- popd

before_script:
- travis_retry sudo pip install -q requests
Expand All @@ -59,6 +65,7 @@ script:
- env
- mvn install -B -e -V -DskipTests=true
- mvn test -B -e -V
- bash cxx-sensors/src/tools/check_rules.sh
- RAILS_ENV=production PATH=$PATH:/tmp/sonar-scanner-3.1.0.1141/bin TestDataFolder=~/build/SonarOpenCommunity/sonar-cxx/integration-tests/testdata behave --no-capture --tags=$SONARAPI

after_failure:
Expand Down
9 changes: 5 additions & 4 deletions cxx-sensors/src/tools/check_rules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

RULES_DIR="$(realpath $SCRIPT_DIR/../main/resources/)"
RULES_DIR="$(readlink -f $SCRIPT_DIR/../main/resources/)"
RULES=( "clangsa.xml" "clangtidy.xml" "compiler-gcc.xml" "compiler-vc.xml" \
"cppcheck.xml" "drmemory.xml" "external-rule.xml" "pclint.xml" \
"rats.xml" "valgrind.xml" "vera++.xml" "external/intel_inspector_rules.xml")
"rats.xml" "valgrind.xml" "vera++.xml" )

declare -i RC_CHECK=0
for RULE in "${RULES[@]}"
Expand All @@ -27,11 +27,12 @@ do
BASE_NAME="$(basename $ABS_PATH_TO_RULE)"
REPORT_PATH="${PWD}/${BASE_NAME}.tidy"
declare -i RC=0
$(python cppcheck_createrules.py check ${ABS_PATH_TO_RULE} > ${REPORT_PATH})
$(python ${SCRIPT_DIR}/cppcheck_createrules.py check ${ABS_PATH_TO_RULE} > ${REPORT_PATH})
RC=$?
if [[ ${RC} -ne 0 ]]
then
echo "[ FAILED ] ${ABS_PATH_TO_RULE}: see ${REPORT_PATH}"
echo "[ FAILED ] ${ABS_PATH_TO_RULE}"
cat ${REPORT_PATH}
else
echo "[ PASSED ] ${ABS_PATH_TO_RULE}"
fi
Expand Down

0 comments on commit b130565

Please sign in to comment.