From 0d5194f4db059a50aa253458631f1f2410f15e86 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Wed, 21 Oct 2015 11:30:23 -0700 Subject: Rename check-lint-count.sh to .bash linthub.io was examining these as POSIX scripts to it was complaining about bash-isms. Move this to .bash to give it a better hint about what kind of file this is. --- scripts/check-lint-count.bash | 57 +++++++++++++++++++++++++++++++++++++++++++ scripts/check-lint-count.sh | 57 ------------------------------------------- 2 files changed, 57 insertions(+), 57 deletions(-) create mode 100755 scripts/check-lint-count.bash delete mode 100755 scripts/check-lint-count.sh (limited to 'scripts') diff --git a/scripts/check-lint-count.bash b/scripts/check-lint-count.bash new file mode 100755 index 0000000..0397477 --- /dev/null +++ b/scripts/check-lint-count.bash @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# +# Checks the number of lint issues against historical values. Used in +# Travis CI builds to fail when the number increases by exploiting the +# caching mechanism. + +if [[ $# != 2 || ! -f $1 ]]; then \ + echo "Usage: $0 " + exit 1 +fi + +lint_file="$1" +historical_file="$2" + +xqilla="$(which xqilla)" + +if [[ ! -x $xqilla ]]; then \ + echo "Error: cannot find xqilla" + exit 1 +fi + +if [[ ! -f $historical_file ]]; then \ + # no cache history, store this one and exit + cp $lint_file $historical_file + exit 0 +fi + +tmp_dir="$(mktemp -d lint.XXXXXXXX)" +trap "rm -rf $tmp_dir" ERR EXIT + +lint_results="$tmp_dir/lint.txt" +hist_results="$tmp_dir/hist.txt" + +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 +} + +run_query $lint_file $lint_results +run_query $historical_file $hist_results + +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 -u $hist_results $lint_results + exit 2 +fi + +if [[ $TRAVIS_PULL_REQUEST == false ]]; then \ + # Okay, we either stayed the same or reduced our number. + # Write it out so we can check it next build! + cp $lint_file $historical_file +fi diff --git a/scripts/check-lint-count.sh b/scripts/check-lint-count.sh deleted file mode 100755 index 0397477..0000000 --- a/scripts/check-lint-count.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env bash -# -# Checks the number of lint issues against historical values. Used in -# Travis CI builds to fail when the number increases by exploiting the -# caching mechanism. - -if [[ $# != 2 || ! -f $1 ]]; then \ - echo "Usage: $0 " - exit 1 -fi - -lint_file="$1" -historical_file="$2" - -xqilla="$(which xqilla)" - -if [[ ! -x $xqilla ]]; then \ - echo "Error: cannot find xqilla" - exit 1 -fi - -if [[ ! -f $historical_file ]]; then \ - # no cache history, store this one and exit - cp $lint_file $historical_file - exit 0 -fi - -tmp_dir="$(mktemp -d lint.XXXXXXXX)" -trap "rm -rf $tmp_dir" ERR EXIT - -lint_results="$tmp_dir/lint.txt" -hist_results="$tmp_dir/hist.txt" - -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 -} - -run_query $lint_file $lint_results -run_query $historical_file $hist_results - -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 -u $hist_results $lint_results - exit 2 -fi - -if [[ $TRAVIS_PULL_REQUEST == false ]]; then \ - # Okay, we either stayed the same or reduced our number. - # Write it out so we can check it next build! - cp $lint_file $historical_file -fi -- cgit v1.2.3