Skip to content

Commit

Permalink
Issue checkstyle#3843: Add check for missing classes in Cobertura cov…
Browse files Browse the repository at this point in the history
…erage report
  • Loading branch information
MEZk committed Feb 26, 2017
1 parent 4bf61e0 commit 3405859
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 150 deletions.
14 changes: 1 addition & 13 deletions .ci/travis/travis.sh
Expand Up @@ -174,25 +174,13 @@ no-exception-test-alot-of-project1)
cobertura-check)
mvn clean compile cobertura:check cobertura:cobertura
xmlstarlet sel -t -m "//class" -v "@name" -n target/site/cobertura/coverage.xml | sed "s/\./\//g" | sed "/^$/d" | sort | uniq > cobertura_classes.log
echo "cobertura_classes.log"
cat cobertura_classes.log
find target/classes -type f -name "*.class" | grep -vE ".*\\$.*" | sed "s/target\/classes\///g" | sed "s/.class//g" | sed "/^$/d" | sort | uniq > target_classes.log
echo "target_classes.log"
cat target_classes.log
xmlstarlet sel -N pom=http://maven.apache.org/POM/4.0.0 -t -m "//pom:instrumentation/pom:excludes" -v "pom:exclude" -n pom.xml | sed "s/*//g" | sed "s/.class//g" | sed "/^$/d" | sort | uniq > cobertura_excluded_classes.log
echo "cobertura_excluded_classes.log"
cat cobertura_excluded_classes.log
# xmlstarlet has an issue. It concatenates these two lines and removes new line character,
# so we need to split them apart. We use the command till update of xmlstarlet to higher version.
sed -i'' "s/com\/puppycrawl\/tools\/checkstyle\/grammars\/javadoc\/com\/puppycrawl\/tools\/checkstyle\/gui\/BaseCellEditor/com\/puppycrawl\/tools\/checkstyle\/grammars\/javadoc\/\ncom\/puppycrawl\/tools\/checkstyle\/gui\/BaseCellEditor/" cobertura_excluded_classes.log
echo "cobertura_excluded_classes.log"
cat cobertura_excluded_classes.log
grep -Fxvf cobertura_classes.log target_classes.log > missed_classes_with_excludes.log
echo "missed_classes_with_excludes.log"
cat missed_classes_with_excludes.log
grep -Fvf cobertura_excluded_classes.log missed_classes_with_excludes.log > missed_classes_without_excludes.log
echo "missed_classes_without_excludes.log"
cat missed_classes_without_excludes.log
grep -Fvf cobertura_excluded_classes.log missed_classes_with_excludes.log > missed_classes_without_excludes.log | cat

if [[ -s missed_classes_without_excludes.log ]] ; then
echo "Classes which are missed in Cobertura coverage report:"
Expand Down
138 changes: 1 addition & 137 deletions .travis.yml
Expand Up @@ -14,153 +14,17 @@ addons:

branches:
only:
- master

install:
- |
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
# https://github.com/travis-ci/travis-ci/issues/6307#issuecomment-233315824
rvm get head
fi
- travis-test

matrix:
fast_finish: true
include:
# testing of PR format
- env:
- DESC="test Issue ref in PR description"
- CMD="./.ci/travis/travis.sh pr-description"

# unit tests (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests and deploy"
- CMD="mvn clean integration-test failsafe:verify"
- DEPLOY="true"

# checkstyle (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="checkstyle and sevntu-checkstyle"
- CMD="mvn clean verify -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true"

# cobertura and codecov (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="cobertura and codecov"
- CMD="./.ci/travis/travis.sh cobertura-check"
- CMD_AFTER_SUCCESS="bash <(curl -s https://codecov.io/bash)"
# findbugs and pmd (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="findbugs and pmd"
- CMD="mvn clean compile pmd:check findbugs:check"

# Releasenotes generation - validaton
- jdk: oraclejdk8
env:
- DESC="Releasenotes generation"
- CMD="./.ci/travis/travis.sh releasenotes-gen"

# NonDex (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NonDex"
- CMD="./.ci/travis/travis.sh nondex"

# site (oraclejdk8 as 'site' success is required to be sure that on release time all will be ok, admins will use oracle8 version)
# moved to https://codeship.com/projects/124310/configure_tests
#- jdk: oraclejdk8
# env:
# - DESC="site"
# - CMD1="mvn clean site -Dlinkcheck.skip=true -DskipTests -DskipITs "
# - CMD2=" -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true "
# - CMD3=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true"
# - CMD=$CMD1$CMD2$CMD3
# - COVERAGE_CMD=""

# unit tests in German locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests de"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=de -Duser.country=DE'"
# unit tests in Spanish locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests es"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=es -Duser.country=ES'"
# unit tests in Finnish locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests fi"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=fi -Duser.country=FI'"
# unit tests in French locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests fr"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=fr -Duser.country=FR'"
# unit tests in Chinese locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests zh"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=zh -Duser.country=CN'"
# unit tests in Japanese locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests ja"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=ja -Duser.country=JP'"
# unit tests in Portuguese locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests pt"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=pt -Duser.country=PT'"
# unit tests in Turkish locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests tr"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=tr -Duser.country=TR'"

# assembly (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="assembly & run '-all' jar"
- CMD="./.ci/travis/travis.sh assembly-run-all-jar"

# NoExceptiontest - Guava with google_checks (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NoExceptionTest - Guava with google_checks"
- CMD="./.ci/travis/travis.sh no-exception-test-guava-with-google-checks"

# release dry run (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="release dry run"
- CMD="./.ci/travis/travis.sh release-dry-run"

# Check the chmod on files.
- env:
- DESC="check permissions on all files"
- CMD="./.ci/travis/travis.sh check-chmod"

# Ensure that all Sevntu check are kused
- jdk: oraclejdk8
env:
- DESC="All sevntu checks should be used"
- CMD="./.ci/travis/travis.sh all-sevntu-checks"

# MacOS verify (till cache is not working, we can not do verify)
- os: osx
env:
- DESC="MacOS verify, site, assembly"
- CMD="export JAVA_HOME=$(/usr/libexec/java_home) && mvn package -Dlinkcheck.skip=true && mvn package -Passembly "

# https://sonarqube.com (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="sonarqube.com"
- CMD="./.ci/travis/travis.sh sonarqube"

script:
- SKIP_FILES=".github|appveyor.yml|circle.yml|distelli-manifest.yml|fast-forward-merge.sh|LICENSE|LICENSE.apache20|README.md|release.sh|RIGHTS.antlr|shippable.yml|wercker.yml"
- SKIP_CI=$(if [[ $(git diff --name-only HEAD HEAD~1 | grep -vE "$SKIP_FILES" | cat | wc -c | sed 's/^ *//' ) > 0 ]]; then echo false; else echo true; fi;)
Expand Down

0 comments on commit 3405859

Please sign in to comment.