mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-06-05 21:15:09 +00:00
Run pylint and mypy on all files in mbedtls_framework
We were missing `mbedtls_framework/code_wrapper/*.py` because we were not traversing the directory recursively. Also improve the comment explaining the duplicate-code workaround for code that's being moved between files in different repositories. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -55,30 +55,32 @@ elif [ "$1" = "--can-mypy" ]; then
|
||||
fi
|
||||
|
||||
echo 'Running pylint ...'
|
||||
# Temporary workaround while moving the bulk of abi_check.py to the framework
|
||||
# Check abi_check.py separately from the rest of the files, so it's not flagged
|
||||
# for code duplication.
|
||||
# Temporary workaround for the transitional wrapper framework/scripts/make_generated_files.py
|
||||
# as well. Once make_generated_files.py exists in both MbedTLS:development and
|
||||
# TF-PSA-Crypto:development branches, we will be able to remove
|
||||
# framework/scripts/make_generated_files.py and, consequently, this exception.
|
||||
find framework/scripts/*.py framework/scripts/mbedtls_framework/*.py scripts/*.py tests/scripts/*.py \
|
||||
# When we move Python code between repositories, there is a transition
|
||||
# period during which code is duplicated between the old repository and
|
||||
# the new repository.
|
||||
# Pylint looks for duplicate code inside files that are mentioned in the
|
||||
# same invocation. When we move some code from A to B, we want to skip
|
||||
# duplicate-code checks between A and B. So we arrange for two separate
|
||||
# runs of pylint: one for the A files, and one for the others.
|
||||
# Remove exceptions below once the A file (or the moved code in the A file)
|
||||
# has been removed from all consuming branches.
|
||||
find framework/scripts scripts tests/scripts -name '*.py' \( \
|
||||
! -path scripts/abi_check.py \
|
||||
! -path framework/scripts/make_generated_files.py \
|
||||
-exec $PYTHON -m pylint {} + \
|
||||
-o -exec $PYTHON -m pylint {} + || {
|
||||
-o -exec $PYTHON -m pylint {} + \) || {
|
||||
echo >&2 "pylint reported errors"
|
||||
ret=1
|
||||
}
|
||||
|
||||
echo
|
||||
echo 'Running mypy ...'
|
||||
$PYTHON -m mypy framework/scripts/*.py framework/scripts/mbedtls_framework/*.py || {
|
||||
$PYTHON -m mypy framework/scripts || {
|
||||
echo >&2 "mypy reported errors in the framework"
|
||||
ret=1
|
||||
}
|
||||
|
||||
$PYTHON -m mypy scripts/*.py tests/scripts/*.py || {
|
||||
$PYTHON -m mypy scripts tests/scripts || {
|
||||
echo >&2 "mypy reported errors in the parent repository"
|
||||
ret=1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user