Skip to content

Commit

Permalink
fix prepare commit
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Dec 15, 2016
1 parent 2ffe1a7 commit 1090e8b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions ci/travis/check_spelling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ if [[ ! -z $TRAVIS_PULL_REQUEST_BRANCH ]]; then
echo "TRAVIS PR BRANCH: $TRAVIS_PULL_REQUEST_BRANCH"
FILES=$(git diff --name-only HEAD $(git merge-base HEAD master) | tr '\n' ' ' )
fi


CODE=$(./scripts/chkspelling_ag.sh)
exit $CODE
./scripts/chkspelling_ag.sh $FILES

6 changes: 4 additions & 2 deletions scripts/chkspelling_ag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
###########################################################################

# optional arguments: files to be checked
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

AGIGNORE=${DIR}/.agignore

RE=$(cut -d: -f1 scripts/spelling.dat | tr '\n' '\|' | sed -e 's/|$//')
if [ ! $# -eq 0 ]; then
EXCLUDE=$(cat ci/travis/.agignore | sed -e 's/\s*#.*$//' -e '/^\s*$/d' | tr '\n' '|' | sed -e 's/|$//')
EXCLUDE=$(cat $AGIGNORE | sed -e 's/\s*#.*$//' -e '/^\s*$/d' | tr '\n' '|' | sed -e 's/|$//')
FILES=$(echo $@ | tr -s '[[:blank:]]' '\n' | egrep -iv "$EXCLUDE" | tr '\n' ' ' )
echo "Running spell check on files: $FILES"
else
Expand All @@ -28,7 +30,7 @@ fi


exec 5>&1
OUTPUT=$(ag --smart-case --all-text --nopager --numbers --word-regexp --path-to-ignore scripts/.agignore "$RE" $FILES |tee /dev/fd/5)
OUTPUT=$(unbuffer ag --smart-case --all-text --nopager --numbers --word-regexp --path-to-ignore $AGIGNORE "$RE" $FILES |tee /dev/fd/5)


if [[ ! -z $OUTPUT ]]; then
Expand Down
6 changes: 1 addition & 5 deletions scripts/prepare-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ set -e

# determine changed files
MODIFIED=$(git status --porcelain| sed -ne "s/^ *[MA] *//p" | sort -u)

CODE=$(./$TOPLEVEL/scripts/chkspelling_ag.sh $MODIFIED)
if [ code -eq 1]; then
exit 1
fi
${TOPLEVEL}/scripts/chkspelling_ag.sh $MODIFIED


if [ -z "$MODIFIED" ]; then
Expand Down

0 comments on commit 1090e8b

Please sign in to comment.