Skip to content

Commit

Permalink
Merge pull request #9056 from bergzand/pr/flake8/shellcheck
Browse files Browse the repository at this point in the history
tools/flake8: fix shellcheck issues
  • Loading branch information
aabadie committed May 7, 2018
2 parents 4948cd0 + 1592de7 commit 28f1162
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dist/tools/flake8/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@

FLAKE8_CMD="python3 -m flake8"

if tput colors &> /dev/null && [ $(tput colors) -ge 8 ]; then
CERROR="\e[1;31m"
CRESET="\e[0m"
if tput colors &> /dev/null && [ "$(tput colors)" -ge 8 ]; then
CERROR=$'\033[1;31m'
CRESET=$'\033[0m'
else
CERROR=
CRESET=
fi

DIST_TOOLS=${RIOTBASE:-.}/dist/tools

. ${DIST_TOOLS}/ci/changed_files.sh
. "${DIST_TOOLS}/ci/changed_files.sh"

FILES=$(FILEREGEX='(?=*.py$|pyterm$)' changed_files)

Expand All @@ -29,16 +29,16 @@ then
fi

${FLAKE8_CMD} --version &> /dev/null || {
printf "${CERROR}$0: cannot execute \"${FLAKE8_CMD}\"!${CRESET}\n"
printf "%s%s: cannot execute \"%s\"!%s\n" "${CERROR}" "$0" "${FLAKE8_CMD}" "${CRESET}"
exit 1
}

ERRORS=$(${FLAKE8_CMD} --config=${DIST_TOOLS}/flake8/flake8.cfg ${FILES})
ERRORS=$(${FLAKE8_CMD} --config="${DIST_TOOLS}/flake8/flake8.cfg" ${FILES})

if [ -n "${ERRORS}" ]
then
printf "${CERROR}There are style issues in the following Python scripts:${CRESET}\n\n"
printf "${ERRORS}\n"
printf "%sThere are style issues in the following Python scripts:%s\n\n" "${CERROR}" "${CRESET}"
printf "%s\n" "${ERRORS}"
exit 1
else
exit 0
Expand Down

0 comments on commit 28f1162

Please sign in to comment.