#! /usr/bin/env sh # Copyright The Mbed TLS Contributors # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later # Purpose: check Python files for potential programming errors or maintenance # hurdles. Run pylint to detect some potential mistakes and enforce PEP8 # coding standards. Run mypy to perform static type checking. # We'll keep going on errors and report the status at the end. ret=0 if type python3 >/dev/null 2>/dev/null; then PYTHON=python3 else PYTHON=python fi check_version () { $PYTHON - "$2" <&2 "pylint reported errors" ret=1 } echo echo 'Running mypy ...' $PYTHON -m mypy framework/scripts || { echo >&2 "mypy reported errors in the framework" ret=1 } $PYTHON -m mypy scripts tests/scripts || { echo >&2 "mypy reported errors in the parent repository" ret=1 } exit $ret