Skip to content

Commit

Permalink
tests/shell-checks: add style checks for do/then
Browse files Browse the repository at this point in the history
  • Loading branch information
austin987 committed Nov 26, 2019
1 parent 6c766e1 commit ac4ca20
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/shell-checks
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ test_formatting() {
if grep -n "$(printf '\t')" "${shellscript}"; then
w_die "${shellscript} contains tabs, please use spaces instead."
fi

# make sure `do` isn't on its own line:
if grep -n -w -e ' do$' -e '^do$' "${shellscript}"; then
w_die "Put 'do' on the same line as 'for/while'"
fi

# make sure `then` isn't on its own line:
if grep -n -w -e ' then$' -e '^then$' "${shellscript}"; then
w_die "Put 'then' on the same line as 'if'"
fi
}

# tests using shellcheck
Expand Down

0 comments on commit ac4ca20

Please sign in to comment.