Skip to content

Commit

Permalink
Merge pull request #84 from chriscool/sumpfralle-more-shellcheck
Browse files Browse the repository at this point in the history
More shellcheck related improvements
  • Loading branch information
chriscool authored Sep 15, 2018
2 parents f39ffe2 + f09607a commit 827ec00
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ doc: all
printf "Generated by "; $(TOMDOCSH) --version; } >API.md

lint:
shellcheck -e SC2034 -e SC2154 -e SC2094 -e SC1090 -e SC2068 -s sh $(INSTALL_FILES)
shellcheck -e SC1090 -e SC2068 -e SC2094 -s sh $(INSTALL_FILES)

lint-extra:
shellcheck -s sh $(INSTALL_FILES)

lint-extra-short:
shellcheck -s sh $(INSTALL_FILES) | grep -o -E 'SC[0-9]+' | sort | uniq

test: all
$(MAKE) -C test

.PHONY: all install uninstall doc lint test
.PHONY: all install uninstall doc lint test lint-extra lint-extra-short
12 changes: 6 additions & 6 deletions aggregate-results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ while read -r file; do
done

if test -n "$failed_tests"; then
printf "\nfailed test(s):%s\n\n" "$failed_tests"
printf '\nfailed test(s):%s\n\n' "$failed_tests"
fi

printf "%-8s%d\n" fixed $fixed
printf "%-8s%d\n" success $success
printf "%-8s%d\n" failed $failed
printf "%-8s%d\n" broken $broken
printf "%-8s%d\n" total $total
printf '%-8s%d\n' fixed $fixed
printf '%-8s%d\n' success $success
printf '%-8s%d\n' failed $failed
printf '%-8s%d\n' broken $broken
printf '%-8s%d\n' total $total
19 changes: 13 additions & 6 deletions sharness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ esac
# TERM is sanitized below, after saving color control sequences.
LANG=C
LC_ALL=C
PAGER=cat
PAGER="cat"
TZ=UTC
EDITOR=:
export LANG LC_ALL PAGER TZ EDITOR
Expand Down Expand Up @@ -148,18 +148,25 @@ if test -n "$color"; then
say_color_pass=$(tput setaf 2) # green
say_color_info=$(tput setaf 6) # cyan
say_color_reset=$(tput sgr0)
say_color_="" # no formatting for normal text
say_color_raw="" # no formatting for normal text
say_color() {
test -z "$1" && test -n "$quiet" && return
eval "say_color_color=\$say_color_$1"
case "$1" in
error) say_color_color=$say_color_error ;;
skip) say_color_color=$say_color_skip ;;
warn) say_color_color=$say_color_warn ;;
pass) say_color_color=$say_color_pass ;;
info) say_color_color=$say_color_info ;;
*) say_color_color=$say_color_raw ;;
esac
shift
printf "%s\\n" "$say_color_color$*$say_color_reset"
printf '%s%s%s\n' "$say_color_color" "$*" "$say_color_reset"
}
else
say_color() {
test -z "$1" && test -n "$quiet" && return
shift
printf "%s\n" "$*"
printf '%s\n' "$*"
}
fi

Expand All @@ -176,7 +183,7 @@ say() {
say_color info "$*"
}

test -n "$test_description" || error "Test script did not set test_description."
test -n "${test_description:-}" || error "Test script did not set test_description."

if test "$help" = "t"; then
echo "$test_description"
Expand Down

0 comments on commit 827ec00

Please sign in to comment.