diff options
author | Kenny Root <kenny@the-b.org> | 2015-10-21 11:22:04 -0700 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2015-10-21 11:23:28 -0700 |
commit | 5167296d8afe1bc945908f3b6b2476feed48a8d1 (patch) | |
tree | 936961d102987759e11df9a489d173cd30eae4ea | |
parent | 04d323d8a87a3eb26bffb1b0cd9613bae854e4f8 (diff) | |
download | connectbot-5167296d8afe1bc945908f3b6b2476feed48a8d1.tar.gz connectbot-5167296d8afe1bc945908f3b6b2476feed48a8d1.tar.bz2 connectbot-5167296d8afe1bc945908f3b6b2476feed48a8d1.zip |
Better lint output for Travis-CI
This uses xqilla to run a better XPath 2.0 query that outputs a terse
one-line description of the problem which is easier to diff in Travis-CI
build output.
-rw-r--r-- | .travis.yml | 2 | ||||
-rwxr-xr-x | scripts/check-lint-count.sh | 28 |
2 files changed, 15 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml index c3ea0d5..54230d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ addons: - ia32-libs-multiarch - libgd2-xpm - p7zip-full - - libxml2-utils # ./scripts/check-lint-count.sh + - xqilla # ./scripts/check-lint-count.sh coverity_scan: project: name: "connectbot/connectbot" diff --git a/scripts/check-lint-count.sh b/scripts/check-lint-count.sh index 5184e13..0397477 100755 --- a/scripts/check-lint-count.sh +++ b/scripts/check-lint-count.sh @@ -12,10 +12,10 @@ fi lint_file="$1" historical_file="$2" -xmllint="$(which xmllint)" +xqilla="$(which xqilla)" -if [[ ! -x $xmllint ]]; then \ - echo "Error: cannot find xmllint" +if [[ ! -x $xqilla ]]; then \ + echo "Error: cannot find xqilla" exit 1 fi @@ -31,22 +31,22 @@ trap "rm -rf $tmp_dir" ERR EXIT lint_results="$tmp_dir/lint.txt" hist_results="$tmp_dir/hist.txt" -echo "cat //issue/location" | \ - xmllint --shell $historical_file | \ - grep '<location' >$lint_results - -echo "cat //issue/location" | \ - xmllint --shell $lint_file | \ - grep '<location' >$hist_results +run_query() { + local xqilla_script='string-join(//issue/location/(concat("file=", @file, " line=", @line, " column=", @column, " reason=", ../@summary)), " ")' + xqilla -i $1 <(echo $xqilla_script) | sed "s,$PWD/,,g" > $2 +} -old_count=$(cat $lint_results | wc -l) -new_count=$(cat $hist_results | wc -l) +run_query $lint_file $lint_results +run_query $historical_file $hist_results -echo "Historical count : $old_count, new count : $new_count" +old_count=$(cat $hist_results | wc -l) +new_count=$(cat $lint_results | wc -l) + +echo "Historical count: $old_count, new count: $new_count" if [[ $new_count > $old_count ]]; then \ echo "FAILURE: lint issues increased from $old_count to $new_count" - diff $lint_results $hist_results + diff -u $hist_results $lint_results exit 2 fi |