Browse Source

Fix shellcheck warnings/errors in shell scripts.

pull/841/head
Geoff Greer 5 years ago
parent
commit
8c3d307a59
  1. 5
      ag.bashcomp.sh
  2. 3
      build.sh
  3. 9
      format.sh
  4. 3
      tests/setup.sh

5
ag.bashcomp.sh

@ -1,3 +1,5 @@
#!/bin/bash
_ag() {
local lngopt shtopt split=false
local cur prev
@ -129,4 +131,7 @@ _ag() {
return 0;;
esac
} &&
# shellcheck disable=SC2086
# shellcheck disable=SC2154,SC2086
complete -F _ag ${nospace} ag

3
build.sh

@ -1,6 +1,6 @@
#!/bin/sh
cd `dirname $0`
cd "$(dirname "$0")" || exit 1
AC_SEARCH_OPTS=""
# For those of us with pkg-config and other tools in /usr/local
@ -13,6 +13,7 @@ then
AC_SEARCH_OPTS="-I /usr/local/share/aclocal"
fi
# shellcheck disable=2086
aclocal $AC_SEARCH_OPTS && \
autoconf && \
autoheader && \

9
format.sh

@ -22,18 +22,21 @@ then
exit 1
fi
SOURCE_FILES=`git ls-files src/`
SOURCE_FILES=$(git ls-files src/)
if [ "$1" == "reformat" ]
then
echo "Reformatting source files"
# shellcheck disable=2086
echo $CLANG_FORMAT -style=file -i $SOURCE_FILES
# shellcheck disable=2086
$CLANG_FORMAT -style=file -i $SOURCE_FILES
exit 0
elif [ "$1" == "test" ]
then
RESULT=`$CLANG_FORMAT -style=file -output-replacements-xml $SOURCE_FILES | grep -c '<replacement '`
if [ $RESULT -eq 0 ]
# shellcheck disable=2086
RESULT=$($CLANG_FORMAT -style=file -output-replacements-xml $SOURCE_FILES | grep -c '<replacement ')
if [ "$RESULT" -eq 0 ]
then
echo "code is formatted correctly :)"
exit 0

3
tests/setup.sh

@ -1,4 +1,7 @@
#!/bin/bash
# All cram tests should use this. Make sure that "ag" runs the version
# of ag we just built, and make the output really simple.
# shellcheck disable=2139
alias ag="$TESTDIR/../ag --nocolor --workers=1 --parallel"
Loading…
Cancel
Save