diff --git a/dist/tools/flake8/check.sh b/dist/tools/flake8/check.sh index ac69ed50a1..3ae73d59aa 100755 --- a/dist/tools/flake8/check.sh +++ b/dist/tools/flake8/check.sh @@ -6,6 +6,8 @@ # General Public License v2.1. See the file LICENSE in the top level # directory for more details. # +. "$(dirname "$0")/../ci/github_annotate.sh" +github_annotate_setup FLAKE8_CMD="python3 -m flake8" @@ -45,6 +47,18 @@ ${FLAKE8_CMD} --version &> /dev/null || { ERRORS=$(${FLAKE8_CMD} --config="${RIOTTOOLS}"/flake8/flake8.cfg ${FILES}) +if github_annotate_is_on; then + echo "${ERRORS}" | grep "^.\+:[0-9]\+:" | while read line; do + FILENAME=$(echo "${line}" | cut -d: -f1) + LINENR=$(echo "${line}" | cut -d: -f2) + DETAILS=$(echo "${line}" | cut -d: -f4- | + sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + github_annotate_error "${FILENAME}" "${LINENR}" "${DETAILS}" + done +fi + +github_annotate_teardown + if [ -n "${ERRORS}" ] then printf "%sThere are style issues in the following Python scripts:%s\n\n" "${CERROR}" "${CRESET}"