1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 23:41:18 +01:00

dist/tools: add PEP8 check to static tests

This commit is contained in:
Alexandre Abadie 2017-11-14 16:57:11 +01:00
parent cde171af0f
commit 035bdf7dcb
3 changed files with 42 additions and 0 deletions

View File

@ -91,6 +91,7 @@ then
run ./dist/tools/cppcheck/check.sh
run ./dist/tools/pr_check/pr_check.sh ${CI_BASE_BRANCH}
run ./dist/tools/coccinelle/check.sh
run ./dist/tools/flake8/check.sh
QUIET=1 run ./dist/tools/headerguards/check.sh
exit $RESULT
fi

38
dist/tools/flake8/check.sh vendored Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
#
# Copyright (C) 2017 Alexandre Abadie <alexandre.abadie@inria.fr>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
if tput colors &> /dev/null && [ $(tput colors) -ge 8 ]; then
CERROR="\e[1;31m"
CRESET="\e[0m"
else
CERROR=
CRESET=
fi
DIST_TOOLS=${RIOTBASE:-.}/dist/tools
. ${DIST_TOOLS}/ci/changed_files.sh
FILES=$(FILEREGEX='*.py$' changed_files)
if [ -z "${FILES}" ]
then
exit 0
fi
ERRORS=$(flake8 --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"
exit 1
else
exit 0
fi

3
dist/tools/flake8/flake8.cfg vendored Normal file
View File

@ -0,0 +1,3 @@
[flake8]
# Allow 119 characters width per line to simplify test output parsing
max-line-length = 119